tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Armbrust" <daniel.armbrust.l...@gmail.com>
Subject Re: misconfigured log4j issue
Date Mon, 04 Feb 2008 18:06:13 GMT
Allright, the deeper I dig, the more confused I get.

I think there is a bug here, bug I still can't pinpoint how it happens.

Let's say I'm deploying 2 web applications - both use struts, and
therefor have dependencies on commons-digester.

App A starts up.  A includes a log4j jar file.  As A starts, it
configures log4j via code within the webapp.  There are no default
log4j config files supplied.

A configures log4j correctly, and there are no extraneous warnings.
At this point, from A, I can write a message to the logger
"org.apache.commons.digester.Digester.sax" and it will be written to
the proper appenders.

Now, tomcat launches webapp B.  Immediately, I get this warning on the
console before any of my init code gets a chance to run:
log4j:WARN No appenders could be found for logger
(org.apache.commons.digester.Digester.sax).
log4j:WARN Please initialize the log4j system properly.

Now, I think that is happening because struts is using
commons-digester to read its xml config files, and commons-digester
includes log4j logging.

But, why don't I get an error when app A starts?

Why does app B only print the warning if app A is started before it?
How can two different webapps be impacting each other like this?

I have tried putting log4j.properties file into all of the various
tomcat global classes directories.  It has no effect.

Running with "-Dlog4j.debug" shows me that when app A initializes,
log4j looks for the default config files.
However, when app B initializes, log4j does NOT look for the default
config files.  I'm not sure why this is happening - why should log4j
from app A impact how log4j behaves in app B?

Thanks,

Dan

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message