LogMX 8.1.0 and Log4j2 JSON 2.4.1

Notes, tips, and other usefull things on how to use LogMX

Moderator: admin

Post Reply
drf
Posts: 1
Joined: Mon Aug 30, 2021 7:16 am

LogMX 8.1.0 and Log4j2 JSON 2.4.1

Post by drf »

I am using the evaluation verison of LogMX 8.1.0 to load a Log4j2 based Json logging file, using version 2.4.1 of Log4j2.

My configuration in log4j2 containes the following lines:

Code: Select all

            <JsonLayout compact="true" eventEol="true" />
So compact and using one line for each log entry.

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}
I have tryed to get configured the json output to give time in millis as well. Then the generated json looks like this:

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}
But I get the same results. See attachments.

I wonder if it possible to get another format for it that is more human readable.
Attachments
Screenshot 2021-08-30 101857.png
Screenshot 2021-08-30 101857.png (10.11 KiB) Viewed 15980 times
Screenshot 2021-08-30 101822.png
Screenshot 2021-08-30 101822.png (10.06 KiB) Viewed 15980 times
admin
Site Admin
Posts: 555
Joined: Sun Dec 17, 2006 10:30 pm

Re: LogMX 8.1.0 and Log4j2 JSON 2.4.1

Post by admin »

Hello,

First, really sorry for the very late response, all the posts on this forum were silently queued, but it's now fixed.

If your issue is that you are trying to have a readable date in the "Timestamp" column, you can do that by going to menu "Tools" > "Options" > tab "Display":
entries-date.png
entries-date.png (27.2 KiB) Viewed 15975 times
Let me know!
Xavier
Post Reply