Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Create logs in JSON format

Avatar

Avatar
Validate 10
Level 3
Shallu_Rohilla
Level 3

Likes

8 likes

Total Posts

69 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Validate 10
Level 3
Shallu_Rohilla
Level 3

Likes

8 likes

Total Posts

69 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 1
View profile
Shallu_Rohilla
Level 3

20-01-2020

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"}

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

104 likes

Total Posts

164 posts

Correct Reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile

Avatar
Give Back 5
Employee
sunjot16
Employee

Likes

104 likes

Total Posts

164 posts

Correct Reply

50 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 25
Give Back 10
Give Back
View profile
sunjot16
Employee

20-01-2020

Answers (0)