Marco Herrn created LOG4J2-2405:
-----------------------------------
Summary: 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
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)