log4j2 Json Layout

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

log4j2 Json Layout

Thome, Jerry
We're using Vert.x and graduated from using JUL to log4j2.  Speed and functionality are great.

Is there information on the choice to represent the timestamp via "instant" as shown below?  It's hard to know what that time represents at a glance.

...
  "endOfBatch" : false,
  "loggerFqcn" : "io.vertx.core.logging.Logger",
  "instant" : {
    "epochSecond" : 1548267755,
    "nanoOfSecond" : 66000000
  },
  "threadId" : 20,
  "threadPriority" : 5,
  "source" : {
...

As there seem to be very few formatting options with the Json Layout, do users tend to customize the entire layout to represent the timestamp in a different format?

Thanks,
Jerry
Reply | Threaded
Open this post in threaded view
|

Re: log4j2 Json Layout

Volkan Yazıcı
Hey Jerry,

You can use log4j2-logstash-layout
<https://github.com/vy/log4j2-logstash-layout> and customize the entire
JSON schema to suit your needs. Additionally, its is garbage-free and
yields superior performance compared to the default JSONLayout.

Best.

On Wed, Jan 23, 2019 at 8:44 PM Thome, Jerry <[hidden email]> wrote:

> We're using Vert.x and graduated from using JUL to log4j2.  Speed and
> functionality are great.
>
> Is there information on the choice to represent the timestamp via
> "instant" as shown below?  It's hard to know what that time represents at a
> glance.
>
> ...
>   "endOfBatch" : false,
>   "loggerFqcn" : "io.vertx.core.logging.Logger",
>   "instant" : {
>     "epochSecond" : 1548267755,
>     "nanoOfSecond" : 66000000
>   },
>   "threadId" : 20,
>   "threadPriority" : 5,
>   "source" : {
> ...
>
> As there seem to be very few formatting options with the Json Layout, do
> users tend to customize the entire layout to represent the timestamp in a
> different format?
>
> Thanks,
> Jerry
>