DEV Community

Discussion on: Java Logging Best Practices: 10+ Tips You Should Know to Get the Most Out of Your Logs

Collapse
 
mateuszjarzyna profile image
Mateusz Jarzyna

You should also always add session/request id (you can use MDC mechanism) to easily grep all logs related to one request.

Also, always gave a name to threads in yours custom thread pool:

[2020-06-29 16:25:34] [thread-2-pool-3] [ERROR ] -some message....

vs

[2020-06-29 16:25:34] [old-session-remover-1] [ERROR ] -some message....
Collapse
 
otisg profile image
Otis Gospodnetić • Edited

+1 for thread naming, good point! -1 for grepping logs in 2020. :)

Collapse
 
gr0 profile image
Rafał Kuć

Good point!