You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/11/06 02:03:00 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=16675996#comment-16675996 ] 

ASF subversion and git services commented on LOG4J2-2405:
---------------------------------------------------------

Commit 53da668755087d83bebf46f035e08d3eaf1f36b5 in logging-log4j2's branch refs/heads/master from [~hupfdule]
[ https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;h=53da668 ]

[LOG4J2-2405] Better handling of %highlight pattern when using
jul-bridge.

Closes #225.


> 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
>         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)