[
https://issues.apache.org/jira/browse/LOG4J2-2341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16797693#comment-16797693
]
Ralph Goers commented on LOG4J2-2341:
-------------------------------------
Nevermind. I see that the real problem is that it is using LogEventJsonMixin
and that is specifying the Log4jLogEvent. That is what really needs to be fixed
so we don't need the other crap.
> JsonLayout not working with AsyncLoggerContextSelector in 2.11.0
> ----------------------------------------------------------------
>
> Key: LOG4J2-2341
> URL: https://issues.apache.org/jira/browse/LOG4J2-2341
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.11.0
> Reporter: Fedor Morozov
> Assignee: Carter Kozak
> Priority: Major
> Fix For: 3.0.0, 2.11.1
>
>
> In version 2.11.0 appenders with JsonLayout don't output json when
> Log4jContextSelector is set to
> org.apache.logging.log4j.core.async.AsyncLoggerContextSelector.
> Here is a sample:
> {code:java}
> package ru.yandex.zen;
> import org.apache.log4j.Logger;
> public class LoggerSample {
> public static void main(String[] args) {
> Logger logger = Logger.getLogger("LoggerSample");
> logger.info("Message 1");
> logger.info("Message 2");
> }
> }
> {code}
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <Configuration status="WARN">
> <Appenders>
> <RandomAccessFile name="RandomAccessFile" fileName="async.log"
> immediateFlush="false" append="false">
> <JsonLayout/>
> </RandomAccessFile>
> </Appenders>
> <Loggers>
> <Root level="info">
> <AppenderRef ref="RandomAccessFile"/>
> </Root>
> </Loggers>
> </Configuration>
> {code}
> Without AsyncLoggerContextSelector the log looks like this:
> {code:java}
> ""
> ""
> {code}
> Without AsyncLoggerContextSelector:
> {code:java}
> {
> "thread" : "main",
> "level" : "INFO",
> "loggerName" : "LoggerSample",
> "message" : "Message 1",
> "endOfBatch" : false,
> "loggerFqcn" : "org.apache.log4j.Category",
> "instant" : {
> "epochSecond" : 1527061940,
> "nanoOfSecond" : 637000000
> },
> "threadId" : 1,
> "threadPriority" : 5
> }
> {
> "thread" : "main",
> "level" : "INFO",
> "loggerName" : "LoggerSample",
> "message" : "Message 2",
> "endOfBatch" : false,
> "loggerFqcn" : "org.apache.log4j.Category",
> "instant" : {
> "epochSecond" : 1527061940,
> "nanoOfSecond" : 717000000
> },
> "threadId" : 1,
> "threadPriority" : 5
> }
> {code}
> In our main application Json logger outputs the provided message in quotes,
> not just an empty string. The problem doesn't appear when using asyncRoot or
> asyncLogger.
> My dependencies:
> {code:java}
> compile 'org.apache.logging.log4j:log4j-api:2.11.0'
> compile 'org.apache.logging.log4j:log4j-core:2.11.0'
> compile "org.apache.logging.log4j:log4j-1.2-api:2.11.0"
> compile "com.fasterxml.jackson.core:jackson-core:2.9.4"
> compile "com.fasterxml.jackson.core:jackson-databind:2.9.4"
> {code}
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)