fego
fego

Reputation: 311

Log4j logging problem with 2 ears in Weblogic

I'm deploying 2 ears in Weblogic 10, A and B. In both of them I have a "log4j.properties" file. At the startup, when the first ear is loading, the logs are to the right file "A.log", but when the second ear is loading, all logs are going to the "B.log" file, even logs related to the first ear. I missed something... any idea ?

Thanks

Edit/Solution : Classloader issue. Add to the weblogic-application.xml :

<wls:prefer-application-packages> <wls:package-name>org.apache.log4j.*</wls:package-name> </wls:prefer-application-packages>

Thks to everyone :)

Upvotes: 3

Views: 4306

Answers (2)

rsp
rsp

Reputation: 23373

It would be my guess that the log4j library that is used by the Weblogic server is used in both your web applications.

If this is the case, both web apps would share a root classloader serving the global libraries loade by Weblogic.

If your web apps each provide a copy of log4j, and if you can choose to load the application classes before the server classes (I don't know Weblogic but for WebSphere the setting is 'classloader mode: parent first / parent last') that might solve your problem.

Upvotes: 2

Anupam Saini
Anupam Saini

Reputation: 2421

Honestly it's hard to tell from here but you can try these:

1) check if the logger names in both of your log4j property files are unique.
2) I think that the .properties file are not cached on disk but still deleting the application deployment directories (should be separate for both the EAR's )

Upvotes: 0

Related Questions