You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@logging.apache.org by "Paul Burrowes (JIRA)" <ji...@apache.org> on 2017/08/03 04:54:00 UTC

[jira] [Updated] (LOG4J2-2000) Highlight converter converts levels to uppercase before lookup

     [ https://issues.apache.org/jira/browse/LOG4J2-2000?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul Burrowes updated LOG4J2-2000:
----------------------------------
    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:
{code}            final String key = entry.getKey().toUpperCase(Locale.ENGLISH);{code}

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.

  was:
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:
{code}            final String key = entry.getKey().toUpperCase(Locale.ENGLISH);{code}

This bug also exists in Level.toLevel().

Possible solutions:
Change Level to reject all non-uppercase levels. This will break things.
Change Level to perform case-insensitive matching in {{toLevel}} by default instead of {{toUpperCase}} on the level name parameter
Introduce a flag to enable or disable non-uppercase level configuration.

        Summary: Highlight converter converts levels to uppercase before lookup  (was: Level.toLevel and Highlight converter converts levels to uppercase before lookup)

> Highlight converter converts levels to uppercase before lookup
> --------------------------------------------------------------
>
>                 Key: LOG4J2-2000
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2000
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Configurators
>    Affects Versions: 2.8.2
>            Reporter: Paul Burrowes
>
> 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:
> {code}            final String key = entry.getKey().toUpperCase(Locale.ENGLISH);{code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)