Sun Application Server 8 and Log4j

In ...\sun\ApplicationServer\domains\domain1\lib\ext, you will find log4j.jar . This, being the extension directory will place log4j.jar high up in the classloader hierarchy.

Suppose I have a 2 EARs to be deployed, each containing a WAR and a EJB JAR. All use log4j and naturally, each will have either log4j.properties or log4j.xml . Say only file logging is configured and all log to different file each.

Now the problem: since lib/ext/log4j.jar is always the one to be used, the first log4j.properties or log4j.xml to be used will rule over the rest and all logging across WARs and EJBJARs will be to the SAME file!

In sun-web.xml, can configure <class-loader> element to not to delegate to parent classloaders (havent tried it). But this does not solve the problem because there seems to be no way to configure likewise for EJBJAR! So even if can place log4j.jar in WEB-INF/lib for WAR and able to log to WAR-specified destinaton file, all the EJBJARs across all EARs will still be using lib/ext/log4j.jar and log to SAME file!

So I have removed lib/ext/log4j.jar . Am I missing out something here? Any insights?

Thanks.

[1167 byte] By [cbt] at [2007-11-26 9:37:05]
# 1

I'm having the same problem....

But I do not have a log4j.jar file under lib/ext. In fact, that path is empty.

I posted my issue under a different forum (Java Enterprise System - General Discussion)

http://forum.java.sun.com/thread.jspa?threadID=5171613

thread is titled: JES5 and log4j inconsistencies from 2005Q4 with multiple web application

Any ideas? I'm offering 10 duke dollars for an answer on my original post.

JJ_ at 2007-7-7 0:29:59 > top of Java-index,Application & Integration Servers,Application Servers...
# 2
I figured out my problem....I'll post an answer on the other thread.JJ
JJ_ at 2007-7-7 0:29:59 > top of Java-index,Application & Integration Servers,Application Servers...
# 3

I'm trying to solve a little different issue. I'd like to enable log4j logging to different files from

-an EJB app

-WebServices using the above EJB

-a web (war) app, using the above webservices.

Can you please help me setting up log4j to enable all my application components to log to different files? Where to place log4j.jar and log4j.properties?

sine_morbo at 2007-7-7 0:29:59 > top of Java-index,Application & Integration Servers,Application Servers...