1

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?

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
cuteBrick
  • 75
  • 2
  • 8
  • 3
    Does this answer your question? [How to exclude a single Class from a Log4j Logger / Appender?](https://stackoverflow.com/questions/5270052/how-to-exclude-a-single-class-from-a-log4j-logger-appender) – sai Jul 04 '20 at 12:46
  • @sai yea, I figured how to adapt it to log4j2, thanks – cuteBrick Jul 04 '20 at 13:03

1 Answers1

2

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>
cuteBrick
  • 75
  • 2
  • 8