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 2017/11/29 01:43:00 UTC

[jira] [Updated] (LOG4J2-2136) Add support for values in MDC in JSONLayout KeyValuePairs

     [ https://issues.apache.org/jira/browse/LOG4J2-2136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kirkdorffer updated LOG4J2-2136:
---------------------------------------
    Description: 
The new KeyValuePair within JSONLayout as implemented for https://issues.apache.org/jira/browse/LOG4J2-1694 doesn't provide support for MDC stored values.

In PatternLayout one can do something like this:

{code}
<Pattern>%d{ISO8601}{UTC} %d{Z}{UTC} [CID:%X{conversation-id}] [%t] %-5p %c{1.} - %m%n</Pattern>
{code}

But it seems that

{code}
<KeyValuePair key="CID" value="%X{conversation-id}"/>
{code}

or even

{code}
<KeyValuePair key="CID" value="${conversation-id}"/>
{code}

doesn't work.

Variable replacement doesn't appear to read from the MDC.

  was:
The new KeyValuePair within JSONLayout as implemented for https://issues.apache.org/jira/browse/LOG4J2-1694 doesn't provide support for MDC stored values.

In PatternLayout one can do something like this:

{{<Pattern>%d{ISO8601}{UTC} %d{Z}{UTC} [CID:%X{conversation-id}] [%t] %-5p %c{1.} - %m%n</Pattern>}}

But it seems that

{{<KeyValuePair key="CID" value="%X{conversation-id}"/>}}

or even

{{<KeyValuePair key="CID" value="${conversation-id}"/>}}

doesn't work.

Variable replacement doesn't appear to read from the MDC.


> Add support for values in MDC in JSONLayout KeyValuePairs
> ---------------------------------------------------------
>
>                 Key: LOG4J2-2136
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2136
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.10.0
>            Reporter: Daniel Kirkdorffer
>              Labels: extra-field, json, mdc
>
> The new KeyValuePair within JSONLayout as implemented for https://issues.apache.org/jira/browse/LOG4J2-1694 doesn't provide support for MDC stored values.
> In PatternLayout one can do something like this:
> {code}
> <Pattern>%d{ISO8601}{UTC} %d{Z}{UTC} [CID:%X{conversation-id}] [%t] %-5p %c{1.} - %m%n</Pattern>
> {code}
> But it seems that
> {code}
> <KeyValuePair key="CID" value="%X{conversation-id}"/>
> {code}
> or even
> {code}
> <KeyValuePair key="CID" value="${conversation-id}"/>
> {code}
> doesn't work.
> Variable replacement doesn't appear to read from the MDC.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)