Hi,
I'm including the following log4j.xml the WEB-INF/classes directory in my WAR file:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="RollingFileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="/logs/jexus.log" />
<param name="Append" value="true" />
<param name="MaxFileSize" value="500kb" />
<param name="MaxBackupIndex" value="2" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p [%C{1}] %d{HH:mm:ss,SSSS} - %m%n"/>
</layout>
</appender>
<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p [%C{1}] %d{HH:mm:ss,SSSS} - %m%n"/>
</layout>
</appender>
<category name="net.sf.jexus">
<priority value="DEBUG" />
<appender-ref ref="RollingFileAppender" />
</category>
<root>
<priority value="ERROR" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4j:configuration>
However, using the above configuration I get my web application specific DEBUG messages appearing in the Tomcat stdout.log log file when I only want them to appear in my jexus.log log file. When I comment out the <root> category, I get the correct behaviour for my app-specific log messages but I don't get any messages appearing in my Tomcat log file and I get the following error message:
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.ConvertUtils).
log4j:WARN Please initialize the log4j system properly.
I also tried moving the log4j.xml to my WEB-INF directory, but this just causes the same issue. Can anyone advise how I should be configuring my log files?