Separate log files for each web application and shared libraries with log4j

Posted by oo_olo_oo on Stack Overflow See other posts from Stack Overflow or by oo_olo_oo
Published on 2010-03-19T16:19:20Z Indexed on 2010/03/19 16:21 UTC
Read the original article Hit count: 382

Filed under:
|
|
|
|

I have few web applications run on the Tomcat server. Each application contains its own log4j library copy inside its own war. This allows for separate, flexible logging configuration per application.

I also have few shared libraries (kept in Tomcat's shared libraries directory). I would like to have shared library loggers output among with the application (which uses them) loggers output (for example: if application A logs to file a.log, and uses library b.jar, I would like b.jar to log also to the a.log file). The problem is, that the shared libraries are loaded by the shared classloader, which causes that they can't access loggers defined by the applications. Is there any solution for this issue?

© Stack Overflow or respective owner

Related posts about log4j

Related posts about logging