Donatien RIVIERE created LOG4J2-2968:
----------------------------------------
Summary: Placeholder with default value containing "}"
Key: LOG4J2-2968
URL: https://issues.apache.org/jira/browse/LOG4J2-2968
Project: Log4j 2
Issue Type: Bug
Components: Lookups
Affects Versions: 2.13.3, 2.14.0
Environment:
Reporter: Donatien RIVIERE
Attachments: StrSubstitutorPatternDefaultValueTest.java
StrSubstitutor does not properly handle the variable default values that
contains "}" because it is interpreted as end of default value.
However, this character is part of the pattern layout format, so it is very
common to expect defining a variable allowing to set a pattern, and fallback to
the default value.
Example:
{code:yaml}
pattern: $\{env:MY_PATTERN:-%date{DEFAULT} %level %m%n}
{code}
This pattern is interpreted as below which is obviously wrong (and not a valid
pattern format).
{code:java}
%date{DEFAULT %level %m%n}
{code}
It would be nice to be able to protected the default value with quotes or any
begin/end character.
Please find the JUnit test case in attachment.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)