You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2006/02/28 05:24:32 UTC
RE: Different log files for different web applications under
Tomcat
see comment below...
At 06:05 PM 2/27/2006 +0100, you wrote:
>Interesting aspect. I never dealt with classloaders. Thanks for this
>improvement of my knowledge.
>
>Heri
>
>> -----Original Message-----
>> From: Javier Gonzalez [mailto:jagonzal@gmail.com]
>> Sent: Monday, February 27, 2006 5:31 PM
>> To: Log4J Users List
>> Subject: Re: Different log files for different web applications under
>> Tomcat
>>
>>
>> It does not start different JVMs - however, given the way the tomcat
>> classloader works (
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
>> instances are separate. I have a bunch of servers with separate log4j
>> configurations on each context to support my point ;)
>>
>> But you made me remember an important point - log4j.jar must
>> be only inside
>> the contexts, and not in $TOMCAT_HOME/common/lib or
>> $TOMCAT_HOME/shared/lib
>>
No, it's perfectly fine to have log4j.jar in either common/lib or
shared/lib *and* have log4j.jar in each webapp's WEB-INF/lib. Logging will
still be separated. The global log4j.jar will be used for Tomcat logging
(assuming you also have commons-logging.jar in common/lib and log4j.xml or
log4j.properties in common/classes) or any application that doesn't include
log4j.jar in WEB-INF/lib. Watch out for log4j.jar's in WEB-INF/lib looking
up log4j.xml in common/classes when performing default configuration at
classloader startup. To prevent this, put log4j.xml in
WEB-INF/classes. If you want to perform manual configuration at a later
time than classloader startup, make the log4j.xml file a dummy file that
has all logging turned off. "log4j.xml" is significant, since Log4j looks
for it in preference to log4j.properties.
Of course, the other option is to use a repository selector such as the
ContextJNDISelector in Log4j-1.3 or the 1.2 compatible version in the sandbox.
Jake
>> On 2/27/06, Bender Heri <HB...@ergonomics.ch> wrote:
>> >
>> > Does Tomcat start a separate JVM for each WEB-INF
>> application? If not,
>> > your suggestion would not work since Log4j is global within one JVM.
>> > Heri
>> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
RE: Different log files for different web applications under Tomcat
Posted by julie gautier <ju...@yahoo.fr>.
Thanks to all of you.
It works fine.
Jacob Kjome <ho...@visi.com> a écrit :
see comment below...
At 06:05 PM 2/27/2006 +0100, you wrote:
>Interesting aspect. I never dealt with classloaders. Thanks for this
>improvement of my knowledge.
>
>Heri
>
>> -----Original Message-----
>> From: Javier Gonzalez [mailto:jagonzal@gmail.com]
>> Sent: Monday, February 27, 2006 5:31 PM
>> To: Log4J Users List
>> Subject: Re: Different log files for different web applications under
>> Tomcat
>>
>>
>> It does not start different JVMs - however, given the way the tomcat
>> classloader works (
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html ), the
>> instances are separate. I have a bunch of servers with separate log4j
>> configurations on each context to support my point ;)
>>
>> But you made me remember an important point - log4j.jar must
>> be only inside
>> the contexts, and not in $TOMCAT_HOME/common/lib or
>> $TOMCAT_HOME/shared/lib
>>
No, it's perfectly fine to have log4j.jar in either common/lib or
shared/lib *and* have log4j.jar in each webapp's WEB-INF/lib. Logging will
still be separated. The global log4j.jar will be used for Tomcat logging
(assuming you also have commons-logging.jar in common/lib and log4j.xml or
log4j.properties in common/classes) or any application that doesn't include
log4j.jar in WEB-INF/lib. Watch out for log4j.jar's in WEB-INF/lib looking
up log4j.xml in common/classes when performing default configuration at
classloader startup. To prevent this, put log4j.xml in
WEB-INF/classes. If you want to perform manual configuration at a later
time than classloader startup, make the log4j.xml file a dummy file that
has all logging turned off. "log4j.xml" is significant, since Log4j looks
for it in preference to log4j.properties.
Of course, the other option is to use a repository selector such as the
ContextJNDISelector in Log4j-1.3 or the 1.2 compatible version in the sandbox.
Jake
>> On 2/27/06, Bender Heri wrote:
>> >
>> > Does Tomcat start a separate JVM for each WEB-INF
>> application? If not,
>> > your suggestion would not work since Log4j is global within one JVM.
>> > Heri
>> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
---------------------------------
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.Téléchargez la version beta.