You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Daniel Kirkdorffer (JIRA)" <ji...@apache.org> on 2018/11/02 20:59:00 UTC

[jira] [Created] (LOG4J2-2495) Enhance PatternLayout %X Format options

Daniel Kirkdorffer created LOG4J2-2495:
------------------------------------------

             Summary: Enhance PatternLayout %X Format options
                 Key: LOG4J2-2495
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2495
             Project: Log4j 2
          Issue Type: Improvement
          Components: Layouts
    Affects Versions: 2.11.1
            Reporter: Daniel Kirkdorffer


One can print out the full MDC key value pair set in a PatternLayout, but can only do so in a format that looks like this: \{key1=val1, key2=val2}

We've been using PatternLayout as a replacement for JSONLayout, due to certain limitations with JSONLayout, but the format for %X key/value lists do not conform to valid JSON syntax, and attempts to convert it using %replace run up against regex limitations (or overly complex regex) for dealing with edge cases (such as values that themselves contain curly brackets).

What would be nice is a means to customize the list output, i.e. to use : instead of =, and to double quote the keys and values, to produce valid JSON.  I assume similar options for other formats, such as XML would be helpful too.

Since we already have %enc for proper encoding, having this key/value list in various formats that %enc supports, would make sense.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)