[ 
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)

Reply via email to