Uploaded image for project: 'SLF4J'
  1. SLF4J
  2. SLF4J-165

Handling of unknown (custom) priorities is different than in log4j (throwing an IllegalStateException than using the effective level of the given Priority / Level / Category)

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.5.x
    • Fix Version/s: None
    • Component/s: log4j-over-slf4j
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

      Description

      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".

        Attachments

          Activity

            People

            • Assignee:
              slf4j-dev SLF4J developers list
              Reporter:
              tjuerge Torsten Juergeleit
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: