wood burning stoves 2.0*
The moose likes Java in General and the fly likes Loading multiple log4j.xml files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Loading multiple log4j.xml files" Watch "Loading multiple log4j.xml files" New topic

Loading multiple log4j.xml files

Jeff Strike

Joined: May 19, 2008
Posts: 15
I have 2 war files, a.war and b.war, both deployed in an ear file. (They need to share session data) Each war has it's own log4j jar and xml file yet only the xml file from a.war is loaded. Is there a way I can have both loaded or is it better to combine the xml files and put them at the ear level instead of each war? We may be adding other war files to the ear so log4j.xml file may be changing.

Paul Clapham

Joined: Oct 14, 2005
Posts: 18541

It's better to combine them into one file at the "ear" level. At least, that works and what you're doing now doesn't work, so that's better in my book.

Depending on what web application server you are using, it might be possible to arrange things so that each "war" ran in a separate class loader (this is what you would have to do).
Jeff Strike

Joined: May 19, 2008
Posts: 15
That's what I did. It works and it's a lot simpler than messing with the classloader.

I agree. Here's the link: http://aspose.com/file-tools
subject: Loading multiple log4j.xml files
Similar Threads
log4j separate file logging problem
Question on ClassLoaders
Accessing a jsp from a war file
Log Issue in OC4j
PropertiesFile in Classpath