日志没有正确写入
slf 版本 slf4j-api-1.7.5.jar、slf4j-log4j12-1.7.5.jar、log4j-1.2.16.jar
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<!-- log4j generic catchall for adapters. -->
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Example DailyRollingFile appender, this is the preferred logging appender -->
<appender name="CommonAdapterAppender" class="org.apache.log4j.DailyRollingFileAppender">
<param name="file" value="/opt/adapter.log" />
<param name="encoding" value="UTF-8" />
<param name="append" value="true" />
<!-- Rollover at the top of every hour -->
<param name="DatePattern" value="'.'yyyy-MM-dd-HH" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern"
value="%d{yyyy-MM-dd HH:mm:ss.SSS-zzz} %5p [%t] %c{1} - %m%n" />
</layout>
</appender>
<!-- Categories -->
<category name="com.other" additivity="false">
<priority value="warn" />
</category>
<logger name="com.adapter" additivity="false">
<level value="debug" />
<appender-ref ref="CommonAdapterAppender"/>
</logger>
<logger name="com.adaptations" additivity="false">
<level value="debug" />
<appender-ref ref="CommonAdapterAppender"/>
</logger>
<root>
<priority value="error" />
<appender-ref ref="CommonAdapterAppender" />
<!-- <appender-ref ref="SyslogAppender"/> -->
</root>
</log4j:configuration>
上面的 log4j 文件被多个适配器使用。第一次写入adapter.log,之后只写入一些组件日志。我还注意到,在第二次之后,它正在向 adapter.log 写入少量日志。
我无法理解这里出了什么问题。有人可以帮我吗?