当我在 Unix 上启动作业时,我遇到了日志问题,实际上日志文件包含所有信息,除了我在 JobExecutionListener 和 AfterJob 方法中写入的日志中的信息。当我使用 Eclipse 时,我可以在控制台中看到报告行。
这里是log4j的配置
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="appenderConsole" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-6p [%-25c{1}] %m%n" />
</layout>
</appender>
<appender name="traceDefaultAppender" class="org.apache.log4j.FileAppender">
<param name="file" value="log.tmp"/>
<param name="encoding" value="ISO-8859-1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-6p [%-25c{1}] %m%n" />
</layout>
</appender>
<appender name="reportDefaultAppender" class="org.apache.log4j.FileAppender">
<param name="file" value="log.tmp"/>
<param name="encoding" value="ISO-8859-1" />
<param name="threshold" value="REPORT#com.cegedimactiv.fwb.core.business.log.LevelReport"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m%n" />
</layout>
</appender>
<logger name="defaultLogger">
<level value="INFO" />
<appender-ref ref="traceDefaultAppender" />
<appender-ref ref="reportDefaultAppender" />
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="appenderConsole" />
</root>
</log4j:configuration>
任何想法?