You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Thome, Jerry" <jt...@follett.com> on 2019/01/23 19:36:17 UTC

log4j2 Json Layout

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

Re: log4j2 Json Layout

Posted by Volkan Yazıcı <vo...@gmail.com>.
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 <jt...@follett.com> 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
>