logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Multiple Applications using Log4j in an App server clashing
Date Mon, 08 Dec 2003 02:37:26 GMT

You have a 3 choices...

1.  Don't provide log4j.jar and log4j.properties for each 
application.  Instead, use the single server-provided instance of Log4j 
along with a single log4j config file (again, at the server level).  You 
would initialize Log4j once on server startup, not for each application 
running in the server.

2.  Do as above, but (as far as providing logj4.jar an the log4j config 
file at the sever level), but initialize log4j with a repository selector 
so that each application can configure itself in its own environment 
separate from that of other applications.  There are existing repository 
selectors in the log4j-sandbox project.

3.  Provide log4j.jar in WEB-INF/lib and your config file in 
WEB-INF/classes (or elsewhere for manual configuration) and make sure your 
server supports servlet-spec recommended classloader behavior where the 
WebappClassLoader is search for classes  before the parent.  This is 
intentionally opposite to that of normal Java2 class loading 
behavior.  Tomcat supports this.   I know JBoss can be configured to 
support this as well.  I can't say much about other servers.


See also:
http://nagoya.apache.org/wiki/apachewiki.cgi?Log4JProjectPages/AppContainerLogging

Jake

At 09:50 AM 12/6/2003 +0000, you wrote:
>Hi,
>
>I am trying to deploy an web application that uses Log4J in a shared 
>hosting environment (ATG Dynamo 5.6.1). Log4J is used by other web 
>applications already deployed in the server. Log4J is in the server classpath.
>
>When I deploy my application, it hijacks the logging of the other 
>applications. Its my understanding that ATG 5.6.1  is Servlet 2.2 
>compliant so it is probably using JDK standard classloading rules (always 
>ask the parent classloader to load the class first). So when an 
>application ask for Log4J classes the application's classloader ask it's 
>parent and so on and eventually find the log4J instance loaded from the 
>server classpath. So my guess is Log4J classes are shared between all 
>applications. When  my application loads it must be reconfiguring that 
>Log4J instance. (this is just a hunch !)
>
>I have log4j.properties in WEB-INF/classes dir and log4j Jar in 
>WEB-INF/lib directory. Is there anyway I could share the log4J instance 
>with other applications without reconfiguring existing loggers ?
>
>Or anyother pointers to resolve this issue is greatly appreciated.
>
>
>Thanks
>Roshan
>
>_________________________________________________________________
>Express yourself with cool emoticons - download MSN Messenger today! 
>http://www.msn.co.uk/messenger
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org


---------------------------------------------------------------------
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