I am looking for to print-out a log in a custom manner.
For example,
currently we have following log structure in form of JSON,
{
"timeMillis" : 1488791217953,
"thread" : "restartedMain",
"level" : "DEBUG",
"loggerName" : "org.springframework.jdbc.datasource.DriverManagerDataSource",
"message" : "hello world",
"endOfBatch" : false,
"loggerFqcn" : "org.apache.commons.logging.impl.SLF4JLocationAwareLog",
"threadId" : 17,
"threadPriority" : 5
}
Now I found that, there were couple of fields are still missing which are important for me to have in a log,
Expected JSON would be likewise :
{
"timeMillis" : 1488791217953,
"thread" : "restartedMain",
"level" : "DEBUG",
..................
"file" : "p1.pck.HelloWorld.java",
"line" : "190",
"application-id" : "101",
"logged in user id " : "199",
"etc" : "etc"
..................
"threadPriority" : 5
}
NOTE : the log configuration file log4j2.yml
has following configuration
JsonLayout:
propertiesAsList: true