简体   繁体   中英

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

<?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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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