我正在尝试根据不同级别创建“不同”附加程序,但到目前为止我找不到隔离日志级别的方法......
<category name="com.sample" additivity="false">
<priority value="INFO" />
<appender-ref ref="AllAsync"/>
<appender-ref ref="ConsoleAppender"/>
</category>
我需要一种方法来仅登陆要附加的 INFO 优先日志。由于 INFO 级别的日志记录也会放在带有 DEBUG 标记的记录器上……这对我没有帮助。
另一件事是对于“相同”的包,我无法定义不同的日志记录附加程序:
<category name="com.sample" additivity="false">
<priority value="INFO" />
<appender-ref ref="AllAsync"/>
<appender-ref ref="ConsoleAppender"/>
</category>
<category name="com.sample" additivity="false">
<priority value="DEBUG" />
<appender-ref ref="AllAsync"/>
<appender-ref ref="ConsoleAppender"/>
</category>
在这里,我收到类似的错误:
log4j:ERROR Attempted to append to closed appender named [AllAsync].
log4j:ERROR Attempted to append to closed appender named [ConsoleAppender].
log4j:ERROR Attempted to append to closed appender named [ConsoleAppender].
log4j:ERROR Attempted to append to closed appender named [ConsoleAppender].