tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Problem with using log4j Tomcat and web application level
Date Mon, 17 Sep 2012 16:31:31 GMT
Hash: SHA1


On 9/16/12 6:19 AM, Kiss Izolda wrote:
> I have configured Tomcat to use log4j according to 
> I have used
> the same My web application is using log4j as
> well. There is no log4j.jar in WEB-INF/lib.

You need to put one in there if you want application-level logging to
work the way you expect.

> How can I prevent Tomcat from using the web application's root
> logger?

Tomcat will not use the web application's logger if you configure the
two logging systems separately. You need:

- - log4j.jar in CATALINA_BASE/lib (for Tomcat's logging)
- - log4j.xml in CATALINA_BASE/lib (for Tomcat's logging config)
- - log4j.jar in webapp's WEB-INF/lib (for app logging)
- - log4j.xml in webapp's WEB-INF/lib (for app logging config)

Also, remember that you have to trigger a configuration operation
before you try to use the logger in your webapp, so make sure you do
that. I'm not sure how to trigger an XML configuration, but for a
property-file-based config, you just have to instantiate a new
"PropertyConfigurator" object. You can probably do something similar
for an XML-based configuration.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message