ppkarwasz commented on issue #2996:
URL: 
https://github.com/apache/logging-log4j2/issues/2996#issuecomment-2369500979

   It is worth noting that in #1813, we agreed to that `addKeyValue()` should 
generate a 
[`MapMessage`](https://logging.apache.org/log4j/2.x/javadoc/log4j-api/org/apache/logging/log4j/message/MapMessage.html)
 instead of adding keys to the context data of the log event.
   
   For those not accustomed to the difference between log message and event, 
there is a note in the [Messages documentation 
page](https://logging.apache.org/log4j/2.x/manual/messages.html).
   Currently `addKeyValue()` fills the content of "labels", whereas it should 
fill the content of "message" in the example below:
   
   ```json
   {
   
     "log.level": "INFO",
     "message": "Unable to insert data into my_table.",
     "error.type": "java.lang.RuntimeException",
     "error.message": null,
     "error.stack_trace": [
       {
         "class": "com.example.Main",
         "method": "doQuery",
         "file.name": "Main.java",
         "file.line": 36
       },
       {
         "class": "com.example.Main",
         "method": "main",
         "file.name": "Main.java",
         "file.line": 25
       }
     ],
     "marker": "SQL",
     "log.logger": "com.example.Main",
   
     "tags": [
       "SQL query"
     ],
     "labels": {
       "span_id": "3df85580-f001-4fb2-9e6e-3066ed6ddbb1",
       "trace_id": "1b1f8fc9-1a0c-47b0-a06f-af3c1dd1edf9"
     },
   
     "@timestamp": "2024-05-23T09:32:24.163Z",
     "log.origin.class": "com.example.Main",
     "log.origin.method": "doQuery",
     "log.origin.file.name": "Main.java",
     "log.origin.file.line": 36,
     "process.thread.id": 1,
     "process.thread.name": "main",
     "process.thread.priority": 5
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to