My configuration in log4j2 containes the following lines:
Code: Select all
<JsonLayout compact="true" eventEol="true" />
The file is loaded correctly but the timestamp does include the milliseconds in unix like timestamp.
This is an example of the generated json:
Code: Select all
{"instant":{"epochSecond":1630310891,"nanoOfSecond":601243700},"thread":"main","level":"INFO","loggerName":"my.app.MyApplication","message":"Starting MyApplication using Java 11.0.12 on erebor with PID ...","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"instant":{"epochSecond":1630310891,"nanoOfSecond":585629300},"thread":"background-preinit","level":"INFO","loggerName":"org.hibernate.validator.internal.util.Version","message":"HV000001: Hibernate Validator 6.2.0.Final","endOfBatch":false,"loggerFqcn":"org.hibernate.validator.internal.util.logging.Log_$logger","threadId":26,"threadPriority":5}
Code: Select all
{"timeMillis":1630044034903,"thread":"main","level":"INFO","loggerName":"my.app.MyApplication","message":"Starting MyApplication using Java 11.0.12 on erebor with PID ... ","endOfBatch":false,"loggerFqcn":"org.apache.commons.logging.LogAdapter$Log4jLog","threadId":1,"threadPriority":5}
{"timeMillis":1630044034934,"thread":"background-preinit","level":"INFO","loggerName":"org.hibernate.validator.internal.util.Version","message":"HV000001: Hibernate Validator 6.2.0.Final","endOfBatch":false,"loggerFqcn":"org.hibernate.validator.internal.util.logging.Log_$logger","threadId":26,"threadPriority":5}
I wonder if it possible to get another format for it that is more human readable.