You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Nate (Jira)" <ji...@apache.org> on 2021/01/06 15:08:00 UTC

[jira] [Created] (LOG4J2-2992) PatternParser.parse() ignores nested Patterns when determining if a Throwable should be appended.

Nate created LOG4J2-2992:
----------------------------

             Summary: PatternParser.parse() ignores nested Patterns when determining if a Throwable should be appended.
                 Key: LOG4J2-2992
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2992
             Project: Log4j 2
          Issue Type: Bug
          Components: Pattern Converters
    Affects Versions: 2.13.1
            Reporter: Nate


Simplified example:

%replace{%ex{full}}{password}{******}

In this example, PatternParser.parse() only considers the %replace{} converter and does not find the %ex inside. In this case, if the PatternLayout doesn't declare  alwaysWriteExceptions="false", it will append an ThrowablePatternConverter anyway, leading to the exception being logged a second time without replace converter processing. It would probably be better if the RegexReplacementConverter (and other converters that support nested patterns) also implements the handlesThrowable() method in a way that delegates this handling to the nested patterns.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)