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: FIXED: files not rolling over - debug dump
Date Mon, 03 Oct 2005 17:17:36 GMT
Quoting David Thielen <david@windward.net>:

> First off, many thank yous to James Stauffer for his help!!!!!
> The problem was that we had log4j.jar in both tomcat/common/lib and
> tomcat/webapps/store/WEB-INF/lib. My guess is that all of tomcat except
> store used the one and store the other - and so both had it locked.

The real problem was with the webapp using either the same Log4j configuration
file as Tomcat or using different configuration files, but both having
identical configuration for the rolling file appender.  The simple fact that
both Tomcat and the webapp had log4j.jar didn't cause the problem, but can lead
to it if you are not careful about your config files.

As a rule of thumb, if you deploy log4j.jar in a webapp in a server with
child-first classloading behavior, you are going to have to make double damn
sure that you provide a default log4j.xml config file for your webapp in
WEB-INF/classes so that it doesn't accidentally find the config file provided
by the server in [Tomcat's case] CATALINA_HOME/common/classes.  I say
"log4j.xml" because if you provide log4j.properties, but the server has
log4j.xml, guess which one take precedence?  You guessed it, the Log4j XML
config file.  Why?  Because given both, Log4j's got to make a decision, and the
XML config file provides more functionality than the properties, so it was
decided that the XML config file would take precedence if both were found.

In the case that you want to perform manual configuration, such as in a servlet
context listener of a log4j config file that isn't in the classpath then, at
the very least, put a dummy, nearly empty, log4j.xml file in WEB-INF/classes. 
This will take care of the issue described above and allow you to do whatever
you want to configure Log4j after that.  In the end, make sure that your
current configuration doesn't write files to the same location as other


> Thanks - dave
> David Thielen
> www.windwardreports.com
> 303-499-2544
> -----Original Message-----
> From: James Stauffer [mailto:stauffer.james@gmail.com]
> Sent: Monday, October 03, 2005 7:02 AM
> To: David Thielen
> Subject: Re: files not rolling over - debug dump
> On 10/1/05, David Thielen <david@windward.net> wrote:
> > Hello;
> >
> > I used WhoLockMe (a nice little utility) and it shows that Tomcat has it
> > opened/locked twice. Same PID.
> >
> > I have 2 webapps that are both logging - but the jar and log4j.xml are
> both
> > on ${catalina}/common/lib & classes.
> >
> > Is this the problem?
> That shouldn't be a problem unless log4j is possibly being configured
> twice.  Are you explicitly configuring log4j or letting it find the
> config file automatically.  Checking the debug log4j output
> (-Dlog4j.debug) should tell you if it is being configured twice.
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
> ---------------------------------------------------------------------
> 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

View raw message