我正在尝试实现Log4j2 custom filter中提到的自定义过滤器。我的lo4j2.xml如下
<?xml version="1.0" encoding="UTF-8"?>
<!-- Logger configuration when running outside of docker -->
<Configuration status="trace" packages=“com.rest.server_common.logging">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p [%t] %c{1}:%L - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="DEBUG">
<com.rest.server_common.logging.MyCustomFilter level="DEBUG"/>
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
启动码头服务器时出现错误
main ERROR Root contains an invalid element or attribute "com.rest.server_common.logging.MyCustomFilter"
这里是什么问题?我什至尝试过移动过滤线
<com.rest.server_common.logging.MyCustomFilter level="DEBUG"/>
在Configuration元素之后,但仍然出现错误
只需关闭。包装在不同的模块中,因此无法识别过滤器。