two log4j files for EAR with two modules

Posted by nicktmro on Stack Overflow See other posts from Stack Overflow or by nicktmro
Published on 2009-11-24T01:57:14Z Indexed on 2010/04/15 7:03 UTC
Read the original article Hit count: 123

Filed under:
|
|

Hi, I have an EAR that is made up of two modules. Both expose services and share common code. Imagine that the ear has a common.jar shared by a webservices.war and webapp.war.

I use log4j to log the activities. I would like to be able to have two log files (webservices.log and webapp.log) capturing the events that are specific to each of them plus all the stuff that is handled by the common.jar.

How should I configure my categories and my appenders to achieve this?

At the moment I have the following packages:
com.myapp for shared stuff
com.myapp.webservices for the webservices and
com.myapp.webapp for the webapp.

My problem is that I don't know how I can capture the com.myapp (common stuff) in both log files by using a single log4j configuration file. I have tried setting up multiple configuration files but when JBoss would work OK Websphere would break and the other way round...

Thank you

© Stack Overflow or respective owner

Related posts about log4j

Related posts about java