简体   繁体   English

log4j2 自定义过滤器中的问题

[英]Issue in log4j2 Custom Filter

I am trying to implement custom filter as mentioned in post Log4j2 custom filter .My lo4j2.xml is as follows我正在尝试实现自定义过滤器,如Log4j2 自定义过滤器后所述。我的 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>

When I start my jetty server,I get the error当我启动码头服务器时,出现错误

main ERROR Root contains an invalid element or attribute "com.rest.server_common.logging.MyCustomFilter"

What is the problem here?这里有什么问题? I have even tried moving filter line我什至试过移动过滤线

<com.rest.server_common.logging.MyCustomFilter level="DEBUG"/>

after Configuration element but I still get the error在配置元素之后,但我仍然收到错误

Just to close.The package was in different module so the filter was not getting recognised.只是为了关闭。包在不同的模块中,所以过滤器没有被识别。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM