https://bz.apache.org/bugzilla/show_bug.cgi?id=63293
Bug ID: 63293 Summary: Tomcat 9.0 logging not working with log4j1.2 after upgraded from Tomcat 8.0 Product: Tomcat 9 Version: 9.0.13 Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: twsatw...@gmail.com Target Milestone: ----- Created attachment 36500 --> https://bz.apache.org/bugzilla/attachment.cgi?id=36500&action=edit This archive contains log4j configuration and sample Tomcat server.log files. [Title] Tomcat 9.0 logging not working with log4j1.2 after upgraded from Tomcat 8.0 [Frequency of Occurrence] Always [System/Software Info] OS: Red Hat Enterprise Linux Server release 7.6 (Maipo) Tomcat: 8.0.52 and 9.0.13 Tomcat Native: 1.2.17 Tomcat APR: 1.6.3 OpenSSL: 1.0.2o OpenJDK (JRE): 1.8.0-171-b11 [Details] 1. log4j 1.2.15 is used as the logging library with Tomcat. 2. A custom log4j configuration is used (see the attached "log4j.properties"). (1) log4j rootLogger is set to INFO, FILE (2) The FILE appender is set to ${catalina.base}/logs/server.log 3. The same environment is used to run Tomcat. The only difference before and after the Tomcat upgrade is Tomcat itself. (Note there exists change in FormAuthenticator and the use of LegacyCookieProcessor as the CookieProcessor for backward compatibility.) 4. When running with Tomcat 8.0.52, some INFO logs from Tomcat (org.apache.catalina.*) appear in ${catalina.base}/logs/server.log" 5. When running with Tomcat 9.0.13, the file ${catalina.base}/logs/server.log is basically empty. 6. Refer to the attached sample server.log files from 8.0.52 and 9.0.13. 7. I checked the source code "org.apache.catalina.core.StandardService.java" in Tomcat 9.0.13. One logging statement in the code looks the same to me. However, I see this log with 8.0.52 but not 9.0.13. 8. This issue is observed in 9.0.13 (and higher). // --- code Snippet [S] --- ... ... protected void startInternal() throws LifecycleException { if(log.isInfoEnabled()) log.info(sm.getString("standardService.start.name", this.name)); // <--- This log appears with 8.0.52 setState(LifecycleState.STARTING); // Start our defined Container first if (engine != null) { synchronized (engine) { engine.start(); } } ... ... // --- code Snippet [E] --- 8. I looked up in the release notes and migration info but seem not seeing Tomcat 9 would not work with log4j1.2. 9. The issue is also observed in Windows platform. [Prerequisites] 1. Tomcat 8.0.52 and 9.0.13 2. OpenSSL library. See the References section. 3. APR library for Linux. See the References section. 4. Tomcat Native library for Linux (this needs to be built from the source code. Tomcat does not include this for Linux.) See the References section. 5. Tomcat needs to be set up using APR/OpenSSL with proper certificate(s). [Setup Steps] 1. Ensure the following files exist under ${catalina.base}\lib (1) log4j.jar (v. 1.2.15) (2) log4j.properties [Procedure To Reproduce] 1. Start Tomcat 8.0.52 and check the file ${catalina.base}/logs/server.log 2. Start Tomcat 9.0.13 and check the file ${catalina.base}/logs/server.log [References] 1. Tomcat (1) Main: https://tomcat.apache.org/index.html (2) 8.0.52 download: https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.52/ (3) 9.0.13 download: https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.13/ 2. log4j1.2 (1) Main: https://logging.apache.org/log4j/1.2/index.html (2) 1.2.15: Download: http://archive.apache.org/dist/logging/log4j/1.2.15/ 3. Tomcat APR: (1) Main: http://apr.apache.org/ (2) 1.6.3 download: http://archive.apache.org/dist/apr/ 4. Tomcat Native (1) Main: https://tomcat.apache.org/native-doc/ (2) 1.2.17 download: https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.17/ 5. OpenSSL (1) Main: https://www.openssl.org/ (2) 1.0.2o: https://www.openssl.org/source/old/1.0.2/ -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org