logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naz S <sn1.naze...@gmail.com>
Subject Custom JSONLayout
Date Wed, 12 Aug 2020 13:56:36 GMT

I'm trying to use JSON layout for a logging format. When I use the default
JSON Layout, I see that there are some fields which are unnecessary to me
(for example, loggerFqcn, endOfBatch, etc).

Then I decided to implement a custom JSON layout. But I see that
JacksonFactory is not visible outside the package. Now I get only necessary
fields from LogEvent and generate JSON format using JSON generator. Every
configuration is done by code. But ultimately I want to configure fields in
log4j2.xml file. Any suggestions?

Also I would like to write logs into a log file. But my custom json layout
doesn't write into a file. Do I have to write a file appender for that?

Many thanks,

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message