cuteBrick
cuteBrick

Reputation: 121

How to exclude a single class from logging in log4j2

I am using log4j2 for logging in my project, with log4j2.xml as a configuration file. I have a class that constantly floods my log file. Is there a way to exclude this class from logging?

Upvotes: 4

Views: 7779

Answers (1)

cuteBrick
cuteBrick

Reputation: 121

How to exclude a single Class from a Log4j Logger / Appender? In this post I found the answer for the log4j. And adapted it like this to work with log4j2:

<Loggers>
    <Logger name="path.to.your.Class" level="off"/>
</Loggers>

Upvotes: 4

Related Questions