My thoughts as an enterprise Java developer.

Wednesday, May 20, 2020

Logging

Level When to use Example Alert Response Environments
Fatal The system can't run Can't connect to main DB Immediately Immediately address All
Error There is a system problem Unable to run a DB query If the count passes a small threshold Keep current on all errors with plan for addressing and escalate as appropriate All
Warning There is a problem that isn't a system problem A specific request took longer than expected to process If the count passes a big threshold Generally stay current with most common logs and optionally create plan and/or escalate as appropriate All
Info Something happened that isn't a problem but is noteworthy Unable to process request because the request was invalid Optionally if the count passes a huge threshold Occasionally review to look for patterns that may need to be addressed Probably prod. Usually test. Always Dev.
Debug Something not noteworthy but useful for inspecting how the system is running A specific query took x milliseconds to run Never None Prod only rarely for some loggers. test rarely. Dev often.