Create logs in JSON format | Community
Skip to main content
Level 4
January 20, 2020
Solved

Create logs in JSON format

  • January 20, 2020
  • 1 reply
  • 3860 views

Hi,

We have a requirement to add create logs in JSON format as Java logging best practice. Just like in Spring we can use ApplicationListener to listen to application and then convert logs to JSON format. Though I have written an Application filter which can add specific default attributes to logs then I can define log pattern to print only those specific attributes in JSON format but I want automatically when I write to logger it gets converted to JSON format and gets logged. 

e.g:

{"timeMillis":1579543027630,"thread":"healthCheckTimer","level":"INFO","loggerName":"abc","message":"Health check success - RESPONSE_CODE=200 "threadPriority":5,"application":"xyz","type":"business"}

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

sunjot16
Adobe Employee
sunjot16Adobe EmployeeAccepted solution
Adobe Employee
January 20, 2020
New Member
April 11, 2024

Hi @shallu_rohilla, did you get any solution? I also have the same use case. Want to output both custom code and AEM OOTB logs in JSON format.