JBoss Community

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

created by Aaron Phillips in JBoss Microcontainer - View the full discussion

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

 

Thanks!

Aaron

Reply to this message by going to Community

Start a new discussion in JBoss Microcontainer at Community