Tomislav Petrović created LOG4J2-3335:
-----------------------------------------
Summary: Logging ends up on stdout intead in the
RollingFileAppender when using Log4J 1.2 bridge
Key: LOG4J2-3335
URL: https://issues.apache.org/jira/browse/LOG4J2-3335
Project: Log4j 2
Issue Type: Bug
Components: Log4j 1.2 bridge
Affects Versions: 2.17.1
Environment: 32bit Tomcat 10 under Windows and Temurin JDK 17,
log4j-1.2-api-2.17.1.jar, log4j-api-2.17.1.jar, log4j-core-2.17.1.jar
Reporter: Tomislav Petrović
I have a webapp running under Tomcat using log4j1 for logging with following
configuration in log4j.properties:
{{log4j.appender.CPJAVACALL=org.apache.log4j.RollingFileAppender}}
{{log4j.appender.CPJAVACALL.File=${catalina.base}/webapps/cpjavacall/log/JavaCallServlet.log
}}
{{log4j.appender.CPJAVACALL.MaxBackupIndex=10}}
{{log4j.appender.CPJAVACALL.MaxFileSize=128MB}}
{{log4j.appender.CPJAVACALL.layout=org.apache.log4j.PatternLayout}}
{{log4j.appender.CPJAVACALL.layout.ConversionPattern=%d\{ISO8601}
C=%5X\{channel} [%25t] %X\{sessionId} %m%n}}
{{log4j.logger.com.example.cp.javacall.JavaCallServlet = ALL, CPJAVACALL}}
With log4j1 everything works OK and log lines end up in JavaCallServlet.log
file.
When moved to log4j2 using Log4J 1.2 bridge the JavaCallServlet.log file is
created but log lines are not written to it.
Instead they are written into tomcat10-stdout.*.log file in following format:
{{16:22:41.382 [http-nio-8080-exec-3] INFO
com.example.cp.javacall.JavaCallServlet - Request ended}}
{{{}16:22:41.396 [http-nio-8080-exec-4] INFO
com.{}}}{{{}example.{}}}{{{}cp.javacall.JavaCallServlet - Request started{}}}
Obviously log lines are not written to my CPJAVACALL appender but to Console
appender only.
Why? Is this a bug or missing functionality in Log4j 1.2 bridge or some error
in my configuration file?
--
This message was sent by Atlassian Jira
(v8.20.1#820001)