Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-2000

Highlight converter converts levels to uppercase before lookup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.8.2
    • None
    • Configurators
    • None

    Description

      If using custom levels that are not uppercase e.g. those in javax.slee.facilities.TraceLevel HighlightConverter cannot map colours to the levels because it converts the key to uppercase before lookup:

                  final String key = entry.getKey().toUpperCase(Locale.ENGLISH);

      The toUpperCase() is unnecessary for style lookup because this already performs a case-insensitive match on the key.

      Possible solutions:

      • After fixing LOG4J2-1999, remove the toUpperCase() and just use the key as-is (breaks config that expects the toUpperCase() behaviour)
      • Use a case-insensitive match in Level.toLevel() instead of toUpperCase() or fall-back to case-insensitive after trying case-sensitive (affects performance)
      • In combination with one of the above, introduce a flag to enable or disable non-uppercase level configuration.

      Attachments

        Activity

          People

            Unassigned Unassigned
            pburrowesOC Paul Burrowes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: