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

Volkan Yazici commented on LOG4J2-3074:
---------------------------------------

Thanks for taking time to give it a shot [~paulrubin37]! I think I see your 
point and this is indeed something simple to pull out. This said, I have a long 
backlog regarding JSON Template Layout and sadly this story is not at the top 
of that list, yet. Nevertheless, I will try to make sure to get this shipped in 
2.15.0.

If you are willing to contribute this feature, I would really appreciate a 
GitHub PR minding the following details:
 * Make sure PR title contains the {{LOG4J2-3074}} word, preferably the same 
title with this JIRA issue
 * Update the javadoc
 * Update {{json-template-layout.adoc}}
 * Update {{changes.xml}}
 * Add some unit tests into {{JsonTemplateLayoutTest}}
 * Try to stick to the coding convention and style already in place

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

Reply via email to