You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2021/07/07 09:04:00 UTC

[jira] [Commented] (LOG4J2-3074) Add replacement parameter to mdc resolver

    [ https://issues.apache.org/jira/browse/LOG4J2-3074?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17376415#comment-17376415 ] 

ASF subversion and git services commented on LOG4J2-3074:
---------------------------------------------------------

Commit 3a86977ecf0e1ea27ec59c587284b8617875b65e in logging-log4j2's branch refs/heads/release-2.x from Volkan Yazici
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=3a86977 ]

LOG4J2-3074 Add replacement parameter to ReadOnlyStringMapResolver.


> Add replacement parameter to mdc resolver
> -----------------------------------------
>
>                 Key: LOG4J2-3074
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3074
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: JsonTemplateLayout
>    Affects Versions: 2.14.1
>            Reporter: Paul Rubin
>            Priority: Minor
>             Fix For: 2.15.0
>
>
> This story aims to add a {{replacement}} parameter to {{ReadOnlyStringMapResolver}} (which is used by {{ThreadContextDataResolver}} and {{MapResolver}}) for modifying the keys of the map before resolving them. That is, given the following JSON template
> {code:json}
> {
>   "user": {
>     "$resolver": "mdc",
>     "pattern": "user:(.*)",
>     "replacement": "$1"
>   }
> }
> {code}
> A {{LogEvent}} with an MDC map composed of {{user:name}}, {{user:role}}, {{sessionId}} entries will generate the following JSON:
> {code:json}
> {
>   "user": {
>     "name": "Paul Rubin",
>     "role": "ADMIN"
>   }
> }
> {code}



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