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

Omer U commented on LOG4J2-3391:
--------------------------------

Thank you for your amazing response time.

additionalFields field is added to event log and works fine. 

However in form of key value array. Since field keys are nearly static, 
wouldn't it be nicer to expose map structure instead, like contextMap does? As 
far as I know this key-value array format is recommended when there are to many 
distinct keys. Please correct me if I am wrong.

 contextMap is directly mapped to field.

{code:xml}
    "contextMap" : {
        "userIp" : "192.168.1.10"
    }
{code}

current implementation in snapshot
{code:xml}
    "additionalFields" : [ 
        {
            "key" : "hostname",
            "value" : "DESKTOP"
        }, 
        {
            "key" : "application",
            "value" : "appname"
        }, 
        {
            "key" : "contextPath",
            "value" : "value"
        }
    ]
{code}

What I was expecting 

{code:xml}
"additionalFields" : {
  "hostname", "DESKTOP",
  "application": "appname",
  "contextPath": "value"
}
{code}


> Add optional additional fields to NoSQLAppender
> -----------------------------------------------
>
>                 Key: LOG4J2-3391
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3391
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>            Reporter: Omer U
>            Assignee: Gary D. Gregory
>            Priority: Major
>             Fix For: 2.17.2
>
>
> Additional fields cannot be added to NoSQLAppender logs. 
> I wasn't able to way a find of attaching fields application server hostname 
> or a simple tag like application server name.
> Only way of adding custom information seems to be ThreadContext



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to