[slf4j-dev] [Bug 174] New: Handling of unknown priorities is different ( throwing an IllegalStateException ) than in log4j (defaulting to Priority. DEBUG)

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Mon Mar 22 17:44:34 CET 2010


http://bugzilla.slf4j.org/show_bug.cgi?id=174

           Summary: Handling of unknown priorities is different (throwing an
                    IllegalStateException ) than in log4j (defaulting to
                    Priority.DEBUG)
           Product: SLF4J
           Version: 1.5.x
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P1
         Component: log4j-over-slf4j
        AssignedTo: slf4j-dev at qos.ch
        ReportedBy: torsten at springide.org


Log4j silently converts an unknown Priority (given as int value or string) to
the default of Priority.DEBUG (see default of switch-case in
"Level.toLevel()").

If log4j-over-slf4j gets an unknown instance of Priority for it various "log()"
methods then it throws an IllegalStateException (see default of switch-case in
"Category.priorityToLevelInt()"):

Caused by: java.lang.IllegalStateException: Unknown Priority TRACE
        at org.apache.log4j.Category.priorityToLevelInt(Category.java:316)
        at org.apache.log4j.Category.log(Category.java:287)


Ok, now you're asking for the actual usecase for someone calling
"Category.log()" with an invalid instance of Priority:

We have a legacy application which has it's own logging abstraction extending
(a very old version of) log4j with it's own log levels. Unluckily, here someone
defined a TRACE level with a different value for "Priority.TRACE_INT" than
Log4js "Level.TRACE_INT".


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list