[jboss-user] [JBoss Microcontainer] - How to force log4j.xml to be read out of my war?

Aaron Phillips do-not-reply at jboss.com
Mon Oct 25 16:53:20 EDT 2010

Aaron Phillips [http://community.jboss.org/people/phyto] created the discussion

"How to force log4j.xml to be read out of my war?"

To view the discussion, visit: http://community.jboss.org/message/568308#568308

Hi folks,

Here's my problem, i have a WAR within an EAR.  Within the EAR itself are all the jars used by the WAR, which has no jars.  My WAR does log4j logging, and contains a log4j.xml in it's WEB-INF/classes.  The problem is, several of the jars in the EAR have also package a log4j.xml within them and the classloader is preferring these inner log4j.xmls to the one in my WAR's WEB-INF/classes.   I should mention that the WAR declares a manifest.mf file that lists the jars in the EAR explicitly.

I think I've confirmed this theory (of the EAR's resources being preffered over WEB-INF/classes), by the following:  I moved all the libs out of the EAR into the WAR's WEB-INF/lib.  My logging works in this case, as I would expect, since WARs honor resources in 'classes' over 'lib'.  

I'd like to keep the jars in the EAR and not have to move them to the WAR.   I have tried listing the log4j.xml in the WAR's manifest ahead of all other resources, but that does not work.  I have also tried twiddling the jboss-classloading.xml to get around this, to no avail.  Any ideas?

For a little more context, see  http://goo.gl/kNqn http://goo.gl/kNqn


Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101025/017cc452/attachment.html 

More information about the jboss-user mailing list