logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manuel Meiners (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LOG4J2-1371) JSONLayout and MultiformatMessage
Date Tue, 19 Apr 2016 05:51:25 GMT
Manuel Meiners created LOG4J2-1371:
--------------------------------------

             Summary: JSONLayout and MultiformatMessage
                 Key: LOG4J2-1371
                 URL: https://issues.apache.org/jira/browse/LOG4J2-1371
             Project: Log4j 2
          Issue Type: Bug
    Affects Versions: 2.5
            Reporter: Manuel Meiners


I configured an appender with JSONLayout

{code:xml}
<Console name="Console" target="SYSTEM_OUT" >
    <JSONLayout compact="false" />
</Console>
{code}

After logging a MapMessage in following way:

{code:java}
final MapMessage mapMessage = new MapMessage();
mapMessage.put("firstname", "John");
mapMessage.put("lastname", "Doe");

LogManager.getLogger().error(mapMessage);
{code}

I get following log output:

{code}
{
  "timeMillis" : 1461044392388,
  "thread" : "main",
  "level" : "ERROR",
  "loggerName" : "com.prognost.spectest.testcases.dccard.rest.RestSpecExecutorTest",
  "message" : "firstname=\"John\" lastname=\"Doe\"",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}
{code}

As you can see the MapMessage was not serialized to JSON. It's the same for other MultiformatMessage
implementations. It seems to me that the MultiformatMessage::getFormattedMessage method isn't
called with "json".



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Mime
View raw message