I am hoping to use log4j2 to log from both my web applications and the server (tomcat 6) itself, ideally all to the same file. The config I have works fine for the web applications, but not for the server classes.
What I want is for lines like the following to be written to a file, (they are currently written to the console only)
Aug 15, 2014 1:03:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-80
Aug 15, 2014 1:03:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1287 ms
I have log4j-api-2.0.1.jar, log4j-core-2.0.1.jar and log4j2.xml in the tomcat/lib directory. A stripped down log4j2.xml is shown below. I don't see any problems in the information given by having status="all". log4j2 is setting itself up automatically - I am not passing in a configurationFile with CATALINA_OPTS.
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="all">
<Appenders>
<RollingFile name="R" fileName="../logs/general.log" filePattern="../logs/general-%d{yyyy-MM-dd}.log" append="true">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy />
</Policies>
<DefaultRolloverStrategy max="1000"/>
</RollingFile>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="R" level="info"/>
<AppenderRef ref="STDOUT" level="error"/>
</Root>
</Loggers>
</Configuration>
Any idea what I am doing wrong?