1

I created 2 PatternLayoutEncoder in my program logger with different fields, 1 for info and debug messages and 2 for warning and error messages.

ThresholdFilter consoleFilter = new ThresholdFilter();
consoleFilter.setLevel("INFO");
consoleFilter.start();
consoleAppenderError.addFilter(consoleFilter);


ThresholdFilter consoleFilterError = new ThresholdFilter();
consoleFilterError.setLevel("WARN");
consoleFilterError.start();
consoleAppenderError.addFilter(consoleFilterError);

The info logger print also the warning and error messages, and I get double messages.

Is there an option to set specific level so that the info logger only receives info and debug messages without error and warning massages?

Hulk
  • 6,399
  • 1
  • 30
  • 52
gal leshem
  • 551
  • 1
  • 6
  • 18
  • I tried to improve the wording of your question a bit - feel free to edit if you don't agree with my changes. – Hulk Nov 18 '21 at 08:50
  • Related - possible duplicate, but I don't know enough about logback to be sure: https://stackoverflow.com/questions/5653062/how-can-i-configure-logback-to-log-different-levels-for-a-logger-to-different-de – Hulk Nov 18 '21 at 08:55

0 Answers0