logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Okara <billok...@gmail.com>
Subject Fwd: is it possible to set container shared lib to use custom loggerContext
Date Fri, 22 Jul 2016 18:18:04 GMT
Hi,

Following is my deployment env:

tomcat7
    |- lib/sharedLib12.jar   // shared lib  used by webapp1 and webapp2
    |- lib/slf4j-api-1.7.7.jar, log4j-api-2.3.jar, log4j-core-2.3.jar,
log4j-slf4j-impl-2.3.jar
    |
    |- webapps
         |-webapp1/WEB-INF/classes/log4j2.xml
         |                                 lib/log4j-web-2.3.jar
         |-webapp2/WEB-INF/classes/log4j2.xml
         |                                 lib/log4j-web-2.3.jar


 With servlet 3.0+ and default ClassLoaderContextSelector, it was
quite simple (awesome!) to config so that log output from each webapp
will be sent to it's own log file (webapp1.log, webapp2.log)

But the problem is that log output from the sharedLib jar will always
goto to the first loaded webapp, because:
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@59717824

the parent classloader (the one sharedLib is loaded) will be assigned
to the loggerContext of the first loaded webapp (which kinda makes
sense).


Question:
is there a way to config so that jars inside the tomcat/lib can be
logged to a common/separate logger context (or log file) that is
independent of the loaded webapp? (without configure tomcat to use
log4j2 as internal logger?)


Thanks!
Bill

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message