I'm trying to get log4j application (webapp) logging working in a Tomcat 6 app. I have log4j-1.2.15.jar in my WEB-INF directory, log4j.dtd and log4j.xml in WEB-INF/classes.
My log4j.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration>
<appender name="massAppender" class="org.apache.log4j.RollingFileAppender">
<param name="maxFileSize" value="100KB" />
<param name="maxBackupIndex" value="2" />
<param name="File" value="${catalina.home}/logs/mass.log" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %5p %c{1}: %m%n " />
</layout>
</appender>
<category name="com.company.mass">
<priority value="DEBUG"/>
<appender-ref ref="massAppender"/>
</category>
<root>
<appender-ref ref="massAppender" />
</root>
</log4j:configuration>
My servlet is in the package:
package com.company.mass;
where the logger is declared as:
private static Logger logger = Logger.getLogger(Handler.class);
and at the top of my doGet(...) method there is:
logger.error("foo");
When I deploy the app in Tomcat and go to the servlet, it works correctly. I even get a mass.log file, but nothing gets put in it. It doesn't show up in any other logs either, and there are no obvious errors. Any idea what's going on?