Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
0.9.25, 1.2.3
Description
INFO and CONFIG messages in JUL are classified as INFO messages in Logback. FINE and FINER messages in JUL are classified as DEBUG messages in Logback. When using the LevelChangePropagator, it is expected when the Logback level is INFO that both INFO and CONFIG messages in JUL are captured. The same should be true about FINE and FINER messages when the Logback level is DEBUG.
However, when the Logback level is INFO, CONFIG messages are not captured; while, INFO messages are. When the Logback level is DEBUG, FINER messages are not captured; while, FINE messages are.
How to Reproduce:
I have attached my logback configuration file as well as a simple main class which logs INFO, CONFIG, FINE, FINER, and FINEST messages.
Solutions:
It appears the problem stems from JULHelper.asJULLevel() method. When the level is DEBUG, FINE is returned. When the level is INFO, then INFO is returned. This method should return FINER for DEBUG and CONFIG for INFO. I have attached a modified version of the JULHelper.
As JULHelper.asJULLevel() is part of the public API this change may impact users that directly call this method. Therefore if you want to preserve backwards compatibility, you can add another method like asLowerJULLevel() which returns FINER and CONFIG in the appropriate place. Then in the LevelChangePropagator call asLowerJULLevel() in the propagate() method.