I'm trying to figure out how to correctly configure the log4j.xml file in association with how to correctly reference it from within my code.
I have a java class that I created for a URL/External Task - the code basically works, but I want to add diagnostic logging for it and preferably put it into my own file (instead of servletd_out.log).
An excerpt of the java code:
...
import org.apache.log4j.Logger;
...
public class MyClassName implements CSURLExternalTask {
...
public void execute(CSClient client, CSExternalTask task, Hashtable hash) throws CSException {
Logger logger = Logger.getLogger("MyClassName");
CSWorkflow job = task.getWorkflow();
logger.debug("=========== STARTING ===========");
...
}
...
}
My log4j.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
<appender name="CUSTOM" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="${log100.iwlogs}/output.log"/>
<param name="MaxFileSize" value="100MB"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p > %c (%x) - %m%n"/>
</layout>
</appender>
<logger name="MyClassName" additivity="false">
<level value="debug"/>
<appender-ref ref="CUSTOM"/>
</logger>
</log4j:configuration>
The results are such that right now - I still see output in servletd_out.log
...
=========== STARTING ===========
...
but nothing is getting put into my custom "output.log".
So - what am I doing wrong here?