Re: migrating from 1.1.3 to 1.2beta

2002-02-12 Thread Ceki Gülcü

Edward,

Could you please provide the XML configuration file? It would make it easier
to deal with the problem you are encountering. Thanks, Ceki

At 18:08 12.02.2002 -0500, Edward Zarecor wrote:
>I'm trying to migrate some working code from log4j 1.1.3 to 1.2beta.  The 
>source compiles fine, but I'm getting the following messages at 
>runtime.  I've noted changes to the .dtd, e.g., that class is not 
>required, not implied.  However, the dtd still allows category and 
>appender tags inside  tags.  Does anyone know the 
>source of these errors?Any help will be greatly appreciated.
>
>Ed.
>
>log4j:ERROR Parsing error on line 11 and column -1
>log4j:ERROR Element "log4j:configuration" does not allow "category" here.
>log4j:ERROR Parsing error on line 16 and column -1
>log4j:ERROR Element "log4j:configuration" does not allow "appender" here.
>log4j:ERROR Parsing error on line 24 and column -1
>log4j:ERROR Element "log4j:configuration" does not allow "appender" here.

--
Ceki Gülcü



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




migrating from 1.1.3 to 1.2beta

2002-02-12 Thread Edward Zarecor

I'm trying to migrate some working code from log4j 1.1.3 to 1.2beta.  The 
source compiles fine, but I'm getting the following messages at 
runtime.  I've noted changes to the .dtd, e.g., that class is not required, 
not implied.  However, the dtd still allows category and appender tags 
inside  tags.  Does anyone know the source of these 
errors?Any help will be greatly appreciated.

Ed.

log4j:ERROR Parsing error on line 11 and column -1
log4j:ERROR Element "log4j:configuration" does not allow "category" here.
log4j:ERROR Parsing error on line 16 and column -1
log4j:ERROR Element "log4j:configuration" does not allow "appender" here.
log4j:ERROR Parsing error on line 24 and column -1
log4j:ERROR Element "log4j:configuration" does not allow "appender" here.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Can I do this with PropertyConfigurator?

2002-02-12 Thread Nair, Ranjini

Joe,

You will have to specify the path as
webapps\MyApp\\arachneTest.log. This should work.

Ranjini

> -Original Message-
> From: Joe Polanik [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, February 12, 2002 4:02 PM
> To:   Log4J Users List
> Subject:  Can I do this with PropertyConfigurator?
> 
> I'm using an initialization servlet with the following lines in the init()
> 
> method:
> 
>  String logFile = config.getInitParameter("logPath");
>  String prefix = getServletContext().getRealPath("/");
>  System.out.println("prefix: " + prefix);
>  if (logFile != null) {
>  PropertyConfigurator.configure(prefix + "WEB-INF\\classes\\"
> + 
> logFile);
>  }
> 
> In web.xml the init parameter is defined as log4j.properties.
> 
> The servlet reads log4j.properties where it finds the following:
> 
> log4j.rootCategory=debug, R
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=arachneTest.log
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
> 
> The problem (as I see it) is that the output log ends up in 
> \bin, whereas I'd like it to be in
> \webapps\MyApp 
> (or some subdirectory of MyApp like 'log'). However any attempt to prepend
> 
> the filename in log4j.properties with path information generates a File
> Not 
> Found error.
> 
> Can this be done? If so, How
> 
> Thanks in Advance for any ideas,
> 
> Joseph Polanik
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:
> 
> For additional commands, e-mail:
> 
> 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Can I do this with PropertyConfigurator?

2002-02-12 Thread Joe Polanik

I'm using an initialization servlet with the following lines in the init() 
method:

 String logFile = config.getInitParameter("logPath");
 String prefix = getServletContext().getRealPath("/");
 System.out.println("prefix: " + prefix);
 if (logFile != null) {
 PropertyConfigurator.configure(prefix + "WEB-INF\\classes\\" + 
logFile);
 }

In web.xml the init parameter is defined as log4j.properties.

The servlet reads log4j.properties where it finds the following:

log4j.rootCategory=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=arachneTest.log
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

The problem (as I see it) is that the output log ends up in 
\bin, whereas I'd like it to be in \webapps\MyApp 
(or some subdirectory of MyApp like 'log'). However any attempt to prepend 
the filename in log4j.properties with path information generates a File Not 
Found error.

Can this be done? If so, How

Thanks in Advance for any ideas,

Joseph Polanik






--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




FallbackErrorHandler.setBackupAppender(null) throws NullPointerException

2002-02-12 Thread T Master

Not sure if this is the desired behaviour.  The same will occur with the other
setter methods.

No I won't be doing this in my code...I was just testing for another issue
(QuietWriter.flush() threw a NullPointerException after changing my
FileAppender's directory to a disk with no space e.g. floppy  - cannot repeat in
a junit test though)

It may be better to throw an IllegalArgumentException, or just to ignore the
parameter if null.


Code from  log4j.varia.FallbackErrorHandler.java
  /+ACoAKg-
 Set the backup appender.
   +ACo-/
  public
  void setBackupAppender(Appender backup) +AHs-
LogLog.debug(+ACI-FB: Setting backup appender to +AFsAIg- +- backup.getName() +- 
+ACIAXQ-.+ACI-)+ADs-
this.backup +AD0- backup+ADs-
  +AH0-

Using log4jv1.2-beta2.

Regards,

T Master.


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: Help with writing on File and Socket Servers

2002-02-12 Thread T Master

First read the manual:
http://jakarta.apache.org/log4j/docs/manual.html

Then read the javadocs:
http://jakarta.apache.org/log4j/docs/api/index.html

Pay attention to SocketAppender   and any of the FileAppender subclasses (decide
which to use).

HTH

T Master

- Original Message -
From: "Aurioles, Jean (CORP, DDEMESIS)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Rocha, Rogelio G (CORP, DDEMESIS)" <[EMAIL PROTECTED]>
Sent: Tuesday, February 12, 2002 9:51 AM
Subject: Help with writing on File and Socket Servers


> Hi Log4J.
>
> I would like to know how to set the properties in order for my Apps to write
> to files and for Socket Servers.
> I do not know how to specify the Appender to take a specific file to write
> logs.
> Actually, if I could find a document or example of how to use these topics,
> it would be a nice to have.
>
> I hope you can help.
>
> Thanks a lot.
>
>
> _
> Jean Paul Derek Aurioles Tapia
> GE Ddemesis
> 4605 Duke Drive 7th Floor.
> Mason, OH 45040
> Tel: (513) 701-6860, DC:8*262-6860, Fax: (513) 701-6815
> e-Mail: Jean.Aurioles @ddemesis. ge.com
>
>
>
> --
> To unsubscribe, e-mail:   
> For additional commands, e-mail: 
>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Help with writing on File and Socket Servers

2002-02-12 Thread Aurioles, Jean (CORP, DDEMESIS)

Hi Log4J.

I would like to know how to set the properties in order for my Apps to write
to files and for Socket Servers.
I do not know how to specify the Appender to take a specific file to write
logs.
Actually, if I could find a document or example of how to use these topics,
it would be a nice to have.

I hope you can help.

Thanks a lot.


_
Jean Paul Derek Aurioles Tapia
GE Ddemesis 
4605 Duke Drive 7th Floor.
Mason, OH 45040
Tel: (513) 701-6860, DC:8*262-6860, Fax: (513) 701-6815
e-Mail: Jean.Aurioles @ddemesis. ge.com



--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




comment on ErrorHandler interface

2002-02-12 Thread T Master

Ceki,

I've looked at the code and how the design works.

I do not believe ErrorHandler.setAppender(Appender) should be public/for use by
a log4j user.
It should only be accessible to the Appender that passed the ErrorHandler
object.

As an Appender may have an alternative ErrorHandler ( the default is
OnlyOnceErrorHandler) specified, it should inform the errorHandler object of
itself to fulfill the bi-directional relationship.
e.g.
public void  Appender.setErrorHandler( ErrorHandler errorHandler)
+AHs-
errorHandler.setAppender( this )+ADs-
this.errorHandler +AD0- errorHandler+ADs-
+AH0-


Allowing the primary appender to then be modified by a log4j user would break
the relationship IMHO.
Only the backup appender should need be specified to fulfill the requirements
(of FallBackHanlder).

Of course, this would mean moving ErrorHandler to the same package as Appender
though. Bad no doubt as it would break existing code.  Alternatively, the method
could be javadocced to state that it should not be used.

Regards,

T Master


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2

2002-02-12 Thread T Master

FYI: http://jakarta.apache.org/log4j/docs/TROUBLESHOOT.html online does not
appear to have been updated.

Thanks for the casting tip. :o)


- Original Message -
From: "Ceki Gülcü" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Monday, February 11, 2002 1:41 PM
Subject: Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2


>
> T Master,
>
> Subsequent to your query, I added the following entry into the
> Troubleshooting guide:
>
> ===
> Compilation errors when using setLevel(org.apache.log4j.Level) from
> the Category class.
> ===
>
> If you are getting complaints such as the following from the compiler,
> do not worry there is an easy solution. But first here is the problem
> reported by the compiler:
>
>[javac] setLevel(org.apache.log4j.Level) in org.apache.log4j.Category
> cannot be applied to (org.apache.log4j.Priority)
>[javac] logger.setLevel(Level.DEBUG);
>
> where logger is a variable of type Logger.
>
> Casting any of the Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR,
> Level.FATAL arguments to Level will make the compiler happy. As in
>
> logger.setLevel((Level) Level.DEBUG);
>
> This cast is always safe because log4j 1.2 will never produce anything
> but Level objects, never Priority objects.
>
> --
> Ceki Gülcü



--
To unsubscribe, e-mail:   
For additional commands, e-mail: