logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Cakalic, James P." <James.Caka...@maritz.com>
Subject RE: use of log4j with servlet
Date Fri, 05 Jan 2001 18:52:55 GMT
There are a couple of possibilities here, I think. First, it sounds like
only _one_ servlet is doing the configuration. True? Are you putting the
configuration in the init method of this servlet? The init method is only
called once when the servlet is loaded. 

Another possibility, depending on servlet engine, is to define a startup
class that does the configuration. This is guaranteed to only be done when
the engine starts. I know that Weblogic permits this. Not sure about Tomcat
or JRun. WebSphere evidently does not. 

An alternative that WebSphere (and perhaps others) provide to a startup
class is a preload servlet. If you have a preload servlet that does the
configuration in its init method, then you can put it in a servlet that is
preloaded but never gets a post.

Best regards,
Jim Cakalic

> -----Original Message-----
> From: Didier Bretin [mailto:dbr@informactis.com]
> Sent: Friday, January 05, 2001 10:33 AM
> To: log4j-user@jakarta.apache.org
> Subject: use of log4j with servlet
> 
> 
> 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 ?
> 
> Thanks.
> -- 
>             .------------------------------------------------.
>     .^.     | Didier Bretin, France | dbr@informactis.com    |
>     /V\     |-----------------------| www.informactis.com    |
>    // \\    |                       `------------------------|
>   /(   )\   | Visit: http://www.multimania.com/cieexcalibur/ |
>    ^^-^^    `------------------------------------------------'
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: log4j-user-help@jakarta.apache.org
> 

Mime
View raw message