Dave Hawkins created LOG4J2-3541:
------------------------------------

             Summary: ThreadContextDataInjector Uses Incorrect Providers Under 
Tomcat
                 Key: LOG4J2-3541
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3541
             Project: Log4j 2
          Issue Type: Bug
          Components: Web/Servlet
    Affects Versions: 2.17.1
         Environment: Tomcat 9.0.58 with the following jars in 
${CATALINA_HOME}/lib:

log4j-api-2.17.1.jar

log4j-core-2.17.1.jar

log4j-jul-2.17.1.jar

JUL LogManager is org.apache.logging.log4j.jul.LogManager
            Reporter: Dave Hawkins


We are using Log4j with tomcat by including it in the boot classpath and using 
Log4jServletContextListener in the web.xml. We are also using the log4j JUL 
LogManager. Web application ContextDataProviders are not being loaded correctly.

I think this is because ThreadContextDataInjector::getServiceProviders is 
sensitive to the web application classpath, but the class, which is shared 
between the web applications and tomcat, statically caches the result. The 
providers list for tomcat is initialized first and is thus incorrectly used for 
the web applications.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to