[ https://issues.apache.org/jira/browse/LOG4J2-575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13944652#comment-13944652 ]
Remko Popma commented on LOG4J2-575: ------------------------------------ Alex, in your stackoverflow comments you mentioned that the problem only exists if the jars are in the Tomcat lib folder, but the problem goes away if you put the jars inside WEB-INF/lib. Or did I misunderstand that? > Log4J2 and Tomee Plus 7.0.47 not working > ---------------------------------------- > > Key: LOG4J2-575 > URL: https://issues.apache.org/jira/browse/LOG4J2-575 > Project: Log4j 2 > Issue Type: Bug > Components: Core > Affects Versions: 2.0-rc1 > Reporter: Alex Gout > Labels: Log4j2, Logger, TomEE > > According to http://logging.apache.org/log4j/2.x/manual/webapp.html, Log4j2 > should work with Tomcat7.0.47. I'm using TomEE Plus 7.0.47. > I have a webapplication deployed with a log4j2.xml in my web-inf/classes > folder. This is the config: > {code:xml} > <?xml version="1.0" encoding="UTF-8"?> > <Configuration status="WARN"> > <Appenders> > <Console name="Console" target="SYSTEM_OUT"> > <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level > %logger{36} - %msg%n"/> > </Console> > <File name="File" fileName="${sys:catalina.home}/logs/testapp.log"> > <PatternLayout> > <pattern>%d %p %C{1.} [%t] %m%n</pattern> > </PatternLayout> > </File> > </Appenders> > <Loggers> > <Logger name="org.alex" level="TRACE" additivity="false"> > <AppenderRef ref="File"/> > </Logger> > <Root level="INFO"> > <AppenderRef ref="Console"/> > </Root> > </Loggers> > </Configuration> > {code} > I have a logger declared in a class with name org.alex.util.JSON: > private static final Logger LOG = LoggerFactory.getLogger(JSON.class); > I'm using slf4j-api 1.7.5, and have the following libs added to the tomcat > lib: > slf4j-api-1.7.5.jar > log4j-api-2.0-rc1.jar > log4j-core-2.0-rc1.jar > log4j-slf4j-impl-2.0-rc1.jar > If I change the Configuration status to TRACE, I can see my configuration > file being picked up and configuration happens as expected. Also I can see > the MBeans being added. > However, there's not one logging statement ending up in my logfile (although > the file is created). I debugged into the log4j2 Logger, and see that the > isEnabled(...) method return false because the logger (com.alex.util.JSON) > has the level "ERROR" set, while the configuration set the package org.alex > to TRACE. > Further investigation shows it uses a DefaultConfiguration configured for > level=ERROR, and only root is configured. > Furthermore I noticed that the classloader for the instance of my logger that > is created at configuration is org.apache.openejb.core.TempClassLoader, while > the classloader of the Logger that is invoked is > org.apache.catalina.loader.StandardClassLoader. I don't know enough of the > whole mechanism to judge whether or not this is to be expected -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org