Log4j2 JSONLayout没有附加closing(])方括号

时间:2017-08-21 08:18:39

标签: java log4j

这是我的log4j2.xml配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="OFF">
    <Appenders>
        <File name="JsonFile" fileName="logs/myLog.log" immediateFlush="true" append="false">
            <JSONLayout complete="true" charset="UTF-8" compact="false" eventEol="false" properties="true"/>
        </File>
    </Appenders>
    <Loggers>
        <Root level="all" includeLocation="true">
            <AppenderRef ref="JsonFile"/>
        </Root>
    </Loggers>
</Configuration>

输出如下:

[
{
  "timeMillis" : 1503303149998,
  "thread" : "Restlet-343114711",
  "level" : "INFO",
  "loggerName" : "my.logger.name",
  "message" : "Import completed successfully",
  "endOfBatch" : false,
  "loggerFqcn" : "org.apache.logging.log4j.spi.AbstractLogger",
  "contextMap" : {
    "class" : "my.package.Class",
    "method" : "getProgress",
    "user" : "myUser"
  },
  "threadId" : 45,
  "threadPriority" : 5
}

缺少结束方括号。如何配置log4j2以添加结束标记?

0 个答案:

没有答案