You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by "Anshu Garg (JIRA)" <ji...@apache.org> on 2016/02/02 10:26:40 UTC

[jira] [Commented] (LOG4J2-908) JSONLayout doesn't add a comma between log events

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

Anshu Garg commented on LOG4J2-908:
-----------------------------------

When complete is set to false, comma is not added to separate records. By documentation complete attribute should only affect header/footer. Here are sample configuration files used and log generated

1. When complete = false 

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF">
  <Appenders>
    <File name="XmlFile" fileName="target/JsonCompleteFileAppenderTest.log" immediateFlush="true" append="false">
      <JSONLayout complete="false" charset="UTF-8" compact="false" eventEol="false"/>
    </File>
  </Appenders>

  <Loggers>
    <Root level="all" includeLocation="true">
      <AppenderRef ref="XmlFile"/>
    </Root>
  </Loggers>
</Configuration>

-----------------------------------------------------

{
  "timeMillis" : 1454404910569,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "First message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}
{
  "timeMillis" : 1454404910699,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "Second message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}
{
  "timeMillis" : 1454404910699,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "Third message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}


**********************************************************************

1. When complete = true 

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF">
  <Appenders>
    <File name="XmlFile" fileName="target/JsonCompleteFileAppenderTest.log" immediateFlush="true" append="false">
      <JSONLayout complete="true" charset="UTF-8" compact="false" eventEol="false"/>
    </File>
  </Appenders>

  <Loggers>
    <Root level="all" includeLocation="true">
      <AppenderRef ref="XmlFile"/>
    </Root>
  </Loggers>
</Configuration>


-----------------------------------------------------

[
{
  "timeMillis" : 1454405040352,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "First message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}
, {
  "timeMillis" : 1454405040462,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "Second message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}
, {
  "timeMillis" : 1454405040462,
  "thread" : "main",
  "level" : "TRACE",
  "loggerName" : "org.apache.logging.log4j.test.TestJira908",
  "message" : "Third message",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger"
}

]


> JSONLayout doesn't add a comma between log events
> -------------------------------------------------
>
>                 Key: LOG4J2-908
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-908
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Layouts
>    Affects Versions: 2.1
>            Reporter: Konstantinos Liakos
>            Assignee: Gary Gregory
>             Fix For: 2.6
>
>
> JSONLayout doesn't output a comma (,) between the log events. This makes it quite difficult to read and deserialize the log files.



--
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