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

Following is my deployment env:

    |- 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,
    |- webapps
         |                                 lib/log4j-web-2.3.jar
         |                                 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:

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

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?)


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

View raw message