[logback-dev] [JIRA] (LOGBACK-1320) Logback not capturing all log messages from JUL

QOS.CH (JIRA) noreply-jira at qos.ch
Wed Jun 28 18:27:00 CEST 2017


Nathan Lighthart created LOGBACK-1320:
-----------------------------------------

             Summary: Logback not capturing all log messages from JUL
                 Key: LOGBACK-1320
                 URL: https://jira.qos.ch/browse/LOGBACK-1320
             Project: logback
          Issue Type: Bug
          Components: logback-classic
    Affects Versions: 1.2.3, 0.9.25
            Reporter: Nathan Lighthart
            Assignee: Logback dev list
            Priority: Minor
         Attachments: JULHelper.java, logback.xml, Main.java

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.



--
This message was sent by Atlassian JIRA
(v7.3.1#73012)


More information about the logback-dev mailing list