log4j2自定义过滤器中的问题

问题描述 投票:-1回答:1

我正在尝试实现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元素之后,但仍然出现错误

java apache jetty log4j2
1个回答
0
投票

只需关闭。包装在不同的模块中,因此无法识别过滤器。

© www.soinside.com 2019 - 2024. All rights reserved.