You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Marco Herrn (JIRA)" <ji...@apache.org> on 2019/06/21 13:08:00 UTC

[jira] [Closed] (LOG4J2-2405) Better handling of %highlight pattern when using jul-bridge

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

Marco Herrn closed LOG4J2-2405.
-------------------------------

> Better handling of %highlight pattern when using jul-bridge
> -----------------------------------------------------------
>
>                 Key: LOG4J2-2405
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2405
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: JUL adapter, Lookups, Pattern Converters
>    Affects Versions: 2.11.1
>            Reporter: Marco Herrn
>            Priority: Minor
>             Fix For: 3.0.0, 2.11.2
>
>         Attachments: jul-bridge-highlight.png
>
>
> When using the jul-bridge and %highlight in the pattern layout, LogLevels that are not mapped to log4j LogLevels incorrectly display "null" in front of the highlighted string.
> See the following pattern:
> {{pattern="%d %highlight{%-6p} [%c{1.}] (%t) %m%n"}}
> that should display the loglevel with color highlighting.
> The following log statements:
> {{
>     LOGGER.log(Level.SEVERE, "SEVERE");
>     LOGGER.log(Level.WARNING,"WARN");
>     LOGGER.log(Level.INFO, "INFO");
>     LOGGER.log(Level.FINE, "FINE");
>     LOGGER.log(Level.FINER, "FINER");
>     LOGGER.log(Level.FINEST, "FINEST");
>     LOGGER.log(Level.CONFIG, "CONFIG");
> }}
> will be displayed as in the attached picture.
> As you can see the FINEST and CONFIG levels are not highlighted (which is acceptable), but are prefixed by "null", which is not acceptable.
> I think it would be well enough to support setting the style for such unknown log levels like:
> {{pattern="%d %highlight{%-6p}{FINEST=black, CONFIG=blue} [%c{1.}] (%t) %m%n"}}
> This would also allow to set a color different than black for these log levels.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)