logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Colic <aco...@yahoo.com>
Subject Re: use of log4j with servlet
Date Fri, 05 Jan 2001 18:51:19 GMT
If you go thorough the same line more than once then check to see if BasicConfigurator==null.
If
it is continue on with the configuration if not skip.

E.g. something like this:

public class myServlet{


private BasicConfigurator=null;

init()
{

if (BasicConfigurator==null)
     {
          BasicConfigurator.configure(new FileAppender (new PatternLayout ("%r [%t]
          %-5p %c %x - %m\n"), "path/to/my/logfile"));
     }

}

Hope this helps

Alex
>-- Ceki Gulcu <cgu@urbanet.ch> wrote:
> 
> Nope.
> 
> At 17:33 05.01.2001 +0100, you wrote:
> 
> >Hello,
> >
> >   I try to use log4j with my servlets applications. In all my servlets of
> >a webapplication I declare in my first servlet for user access the
> >BasicConfigurator with:
> >
> >BasicConfigurator.configure(new FileAppender (new PatternLayout ("%r [%t]
> >%-5p %c %x - %m\n"), "path/to/my/logfile"));
> >
> >Sometimes, I go throw this line more than one time and if I do this, I got
> >the same log message in my log file.
> >
> >Is there a way to detect if a BasicConfigurator is already configurate ?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

Mime
View raw message