Hi Ceci. I have attached a basic main program logbacksample.tar.gz It contains JUL logging statements at various levels, and it uses jul-to-slf4j to make Logback handle the output. When you run mvn exec:java -Dexec.mainClass=com.example.logbacksample.JulLoggerLevels -DcustomLogLevel=debug, it outputs:
Root level is DEBUG DEBUG c.e.logbacksample.JulLoggerLevels - Fine (should be slf4j debug) INFO c.e.logbacksample.JulLoggerLevels - Config (should be slf4j info) INFO c.e.logbacksample.JulLoggerLevels - Info WARN c.e.logbacksample.JulLoggerLevels - Warning (should be slf4j warn) ERROR c.e.logbacksample.JulLoggerLevels - Severe (should be slf4j error)
This proves that JUL logger.config() is output as SLF4J INFO. But when you run mvn exec:java -Dexec.mainClass=com.example.logbacksample.JulLoggerLevels -DcustomLogLevel=info, (to set the root SLF4J logger to INFO), then it outputs:
Root level is INFO INFO c.e.logbacksample.JulLoggerLevels - Info WARN c.e.logbacksample.JulLoggerLevels - Warning (should be slf4j warn) ERROR c.e.logbacksample.JulLoggerLevels - Severe (should be slf4j error)
The Config line is missing even though it should also be INFO. The problem is that the JUL logger.config(), which JUL-to-SLF4J considers to be SLF4J INFO, was incorrectly filtered out when I set the SLF4J root logger level to INFO, because the LevelChangePropagator considers JUL CONFIG to be less than SLF4J INFO. See #557 the fix. |