Atle Tokle created LOG4J2-2248:

             Summary: Using MapMessage and JsonLayout should create json for 
the Map key/values
                 Key: LOG4J2-2248
             Project: Log4j 2
          Issue Type: Improvement
          Components: Layouts
    Affects Versions: 2.10.0
            Reporter: Atle Tokle

I want to add extra parameters to structured Json output, and can do that by 
using ThreadContext, like shown in code below.
ThreadContext.put("key1", value1);
ThreadContext.put("key2", value2);"Values");
This is very intrusive in the code, and I tried to use MapMessage instead like 
this. MapMessage().with("key1", "value1").with("key2", 
I see that the MapMessage can format messages as key="value", json, java and 
XML. I use a JsonAppender to ouput a format that is easy indexable by our 
log-management system. But the MapMessage is not output as json. I get this:
"message" : "key1=\"value1\" key2=\"value2\"", {code}
But I want:
"message" : {"key1" : "value1", "key2" : "value2" }{code}

This message was sent by Atlassian JIRA

Reply via email to