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 Ke...@bmwna.com on 2003/11/21 16:36:30 UTC

RE: setting up multiple log4j configurations for multiple WAR pac kage s?

IMHO, the simplest and easiest configuration to maintain is to place
log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR.  This
should work fine without any additional server configuration.  You should
not have log4j.jar in your server's classpath or logging won't be separate
between webapps.

Ken

> -----Original Message-----
> From: Yuzwa, Erik [mailto:Erik.Yuzwa@encana.com]
> Sent: Friday, November 21, 2003 8:30 AM
> To: 'Log4J Users List'
> Subject: setting up multiple log4j configurations for multiple WAR
> package s?
> 
> 
> Hi all,
> 
> I'm sorry if this is a FAQ, as I've looked everywhere and 
> can't find very
> many
> resources on setting up multiple log4j configurations for 
> different WAR
> packages
> (ie. a seperate set of log files for each WAR app).
> 
> I've tried including a log4j.xml and log4j.blah.jar file with 
> each WAR, but
> that
> doesn't seem to work properly.
> 
> Is there a configuration setting that I'm missing on the 
> servlet container
> itself?
> Should the log4j.blah.jar file be in the classpath of the 
> servlet container
> or 
> remain on the application layer?
> 
> thanks!
> 
> ---------------------------------------------------------------------
> 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


Re: setting up multiple log4j configurations for multiple WAR pac kage s?

Posted by Jacob Kjome <ho...@visi.com>.
No, his statement is incorrect.  You can utilize a repository selector to 
separate logging using a single instance of log4j.jar.  Read here...

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

In fact, if you use Tomcat, even without using a repository selector, you 
can provide for container logging and webapp logging, all completely 
separated.  Put log4j.jar in CATALINA_HOME/common/lib, put a log4j.xml in 
CATALNIA_HOME/common/classes, and then put log4j.jar in each WEB-INF/lib 
and either do manual configuration with log4j.xml somewhere like WEB-INF or 
do auto-config with it in WEB-INF/classes.  All your logging should be 
separated without even bothering with a repository selector.  This behavior 
depends on the way the class loaders are set up, though.  Tomat loads 
classes and resources from the WebappClassLoader preferentially to higher 
class loaders.  This is opposite the normal Java2 class loader behavior, 
but defined (I believe) by the servlet spec.  Other containers such as 
JBoss don't seem to do this by default, although you can configure them to 
do it.  As such, using the repository selectors is the only guaranteed way 
to achieve separated logging.

Jake

At 04:01 AM 11/22/2003 -0800, you wrote:
>So if the server itself uses log4j for logging, does that mean that you 
>will not be able to configure individual web apps to work independently of 
>each other and or the server?
>
>On Friday, November 21, 2003, at 07:36 AM, Ken.Liu@bmwna.com wrote:
>
>>IMHO, the simplest and easiest configuration to maintain is to place
>>log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR.  This
>>should work fine without any additional server configuration.  You should
>>not have log4j.jar in your server's classpath or logging won't be separate
>>between webapps.
>>
>>Ken
>>
>>>-----Original Message-----
>>>From: Yuzwa, Erik [mailto:Erik.Yuzwa@encana.com]
>>>Sent: Friday, November 21, 2003 8:30 AM
>>>To: 'Log4J Users List'
>>>Subject: setting up multiple log4j configurations for multiple WAR
>>>package s?
>>>
>>>
>>>Hi all,
>>>
>>>I'm sorry if this is a FAQ, as I've looked everywhere and
>>>can't find very
>>>many
>>>resources on setting up multiple log4j configurations for
>>>different WAR
>>>packages
>>>(ie. a seperate set of log files for each WAR app).
>>>
>>>I've tried including a log4j.xml and log4j.blah.jar file with
>>>each WAR, but
>>>that
>>>doesn't seem to work properly.
>>>
>>>Is there a configuration setting that I'm missing on the
>>>servlet container
>>>itself?
>>>Should the log4j.blah.jar file be in the classpath of the
>>>servlet container
>>>or
>>>remain on the application layer?
>>>
>>>thanks!
>>>
>>>---------------------------------------------------------------------
>>>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
>>
>
>
>---------------------------------------------------------------------
>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


Re: setting up multiple log4j configurations for multiple WAR pac kage s?

Posted by Dennis Cook <de...@cook-mail.net>.
So if the server itself uses log4j for logging, does that mean that you 
will not be able to configure individual web apps to work independently 
of each other and or the server?

On Friday, November 21, 2003, at 07:36 AM, Ken.Liu@bmwna.com wrote:

> IMHO, the simplest and easiest configuration to maintain is to place
> log4j.jar in WEB-INF/lib and log4j.xml in WEB-INF/classes in each WAR. 
>  This
> should work fine without any additional server configuration.  You 
> should
> not have log4j.jar in your server's classpath or logging won't be 
> separate
> between webapps.
>
> Ken
>
>> -----Original Message-----
>> From: Yuzwa, Erik [mailto:Erik.Yuzwa@encana.com]
>> Sent: Friday, November 21, 2003 8:30 AM
>> To: 'Log4J Users List'
>> Subject: setting up multiple log4j configurations for multiple WAR
>> package s?
>>
>>
>> Hi all,
>>
>> I'm sorry if this is a FAQ, as I've looked everywhere and
>> can't find very
>> many
>> resources on setting up multiple log4j configurations for
>> different WAR
>> packages
>> (ie. a seperate set of log files for each WAR app).
>>
>> I've tried including a log4j.xml and log4j.blah.jar file with
>> each WAR, but
>> that
>> doesn't seem to work properly.
>>
>> Is there a configuration setting that I'm missing on the
>> servlet container
>> itself?
>> Should the log4j.blah.jar file be in the classpath of the
>> servlet container
>> or
>> remain on the application layer?
>>
>> thanks!
>>
>> ---------------------------------------------------------------------
>> 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
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org