我有一个 log4j2.xml 如下:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration>
<Properties>
<Property name="dir" value="/var/log/sunverge" />
<Property name="file" value="maggie.log" />
<Property name="eatonemcbfile" value="eaton.log" />
</Properties>
<Appenders>
<Console name="STDOUT" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ISO8601} %5p [%t] %c - %m%n" />
</Console>
<RollingFile name="file" fileName="${dir}/${file}"
filePattern="${dir}/${file}.%d{yyyy-MM-dd}">
<PatternLayout>
<Pattern>%d{ISO8601} %5p [%t] %c - %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" />
</Policies>
</RollingFile>
<RollingFile name="eaton"
fileName="${dir}/${eatonemcbfile}"
filePattern="${dir}/${eatonemcbfile}.%d{yyyy-MM-dd}">
<PatternLayout>
<Pattern name="ConversionPattern"> %d{ISO8601} %5p [%t] %c - %m%n</Pattern>
</PatternLayout>
<ThresholdFilter level="debug"/>
<Policies>
<TimeBasedTriggeringPolicy interval="1" />
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Root level="warn">
<AppenderRef ref="file" />
</Root>
<logger name="com.sunverge.devices.eaton.emcb" level="info">
<AppenderRef ref="eaton" />
<AppenderRef ref="file" />
</logger>
</Loggers>
</Configuration>
但是,我将eaton.log 的阈值设置为调试,但它们都记录了调试级别。出于某种原因,我不想为另一个文件添加 ThresholdFilter 标记。任何帮助表示赞赏。