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

Andrew Oberstar commented on LOG4J2-2312:
-----------------------------------------

I've run into the same issue (I'm using 2.11.0). If I use

 

```

-Dlog4j2.contextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

```

 

My logs only contain:

 

```

"My message"

```

 

If I don't use the aync context selector:

 

```

{
  "thread" : "main",
  "level" : "INFO",
  "loggerName" : "com.example.Main",
  "message" : "My message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger",
  "instant" : {
    "epochSecond" : 1524677715,
    "nanoOfSecond" : 883000000
  },
  "contextMap" : \{ },
  "threadId" : 1,
  "threadPriority" : 5
}

```

 

 

> Using async appender with json layout causes only the message to be written
> ---------------------------------------------------------------------------
>
>                 Key: LOG4J2-2312
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2312
>             Project: Log4j 2
>          Issue Type: Bug
>            Reporter: David Knapp
>            Priority: Major
>         Attachments: async_trace.txt, synchronous_trace.txt
>
>
> When using the async appender combined with the JsonLayout, you only get the 
> results of the message being written to the appender.
>  
> I took a look at it seems like this is because RingBufferLogEvent implements 
> ReusableMessage which is where jackson gets the MessageSerializer, whereas 
> the non async LogEvent doesn't, so it gets the BeanSerializer
> Attached are traces, both of which originating from the 
> MessageSerializer.serialize method



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to