[
https://issues.apache.org/jira/browse/LOG4J2-3561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17572268#comment-17572268
]
ASF subversion and git services commented on LOG4J2-3561:
---------------------------------------------------------
Commit 7fde2599121113b93ba3331e05740ac691f1ef74 in logging-log4j2's branch
refs/heads/release-2.x from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=7fde259912 ]
[LOG4J2-3561] Support both whitespace and commas in %style
The %style pattern is inconsistent with the %highlight pattern: the
first separates styles with commas, the second one with spaces. This
should
> Ansi color with spaces in style pattern not supported
> -----------------------------------------------------
>
> Key: LOG4J2-3561
> URL: https://issues.apache.org/jira/browse/LOG4J2-3561
> Project: Log4j 2
> Issue Type: Improvement
> Components: Layouts
> Affects Versions: 2.18.0
> Reporter: Robert Papp
> Priority: Minor
>
> _Extracted from
> https://issues.apache.org/jira/browse/LOG4J2-3537?focusedCommentId=17570358&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17570358
> comment._
> After updating from 2.17.2 to 2.18.0 this exception started coming up:
> {code:java}
> WARN The style attribute bright white is incorrect.
> java.lang.IllegalArgumentException: No enum constant
> org.apache.logging.log4j.core.pattern.AnsiEscape.BRIGHT WHITE
> at java.base/java.lang.Enum.valueOf(Enum.java:240)
> at
> org.apache.logging.log4j.util.EnglishEnums.valueOf(EnglishEnums.java:67)
> at
> org.apache.logging.log4j.util.EnglishEnums.valueOf(EnglishEnums.java:50)
> at
> org.apache.logging.log4j.core.pattern.AnsiEscape.createSequence(AnsiEscape.java:486)
> at
> org.apache.logging.log4j.core.pattern.StyleConverter.newInstance(StyleConverter.java:96)
> {code}
> for config:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration
> xmlns="http://logging.apache.org/log4j/2.0/config"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> strict="true"
> status="warn"
>
> xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/apache/logging-log4j2/master/log4j-core/src/main/resources/Log4j-config.xsd"
> >
> <Properties>
> <Property name="pattern_level_colors">
> FATAL=bright magenta, ERROR=bright red, WARN=bright
> yellow, INFO=dim white, DEBUG=bright black, TRACE=cyan
> </Property>
> <Property name="pattern_styled">%highlight{%date{ISO8601}
> %-5level [%thread] %logger(%file:%line)}{${
> pattern_level_colors}} %style{%message}{bright
> white}%n%style{%throwable}{BG_red,white}
> </Property>
> </Properties>
> <Appenders>
> <Appender type="Console" name="color-console">
> <Layout type="PatternLayout"
> pattern="${pattern_styled}" />
> </Appender>
> </Appenders>
> {code}
> doing this fixed the issue:
> {code:java}
> -%style{%message}{bright white}
> +%style{%message}{bright_white}
> {code}
> [~pkarwasz] said
> {quote}The problem you are having is not with the highlight pattern, but the
> style pattern:
> * the highlight pattern separates the keywords with white space: e.g.
> "INFO=bright white",
> * the style pattern separates the keywords with commas: e.g. "bright, white".
> I agree that this is inconsistent, but it is easily fixable: instead of just
> using commas as separators in the style pattern, we can use commas or white
> space. This way we take care of backward compatibility and bring some
> consistency to the two patterns.{quote}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)