...

/

Logging in Back-End Services

Logging in Back-End Services

Understand the importance of adding logs to a server. Learn when and how to add logs.

Logging is an essential aspect of building robust back-end systems. Our logs are critical in helping us debug our applications in real time to understand how they’re performing, triage any issues as soon as they come up, and do so efficiently. To be able to do so, however, we need to be intelligent and diligent with our logging.

What are log levels?

We typically categorize logs into the following four levels of verbosity or criticality:

  • Debug: These logs are essentially dev environment specific and are often not useful past the initial code-writing stage.

  • Info: These logs provide us with valuable information that can help keep us apprised of the exact workings of our system, so we can be sure that everything is working okay. It can also be used to log some metrics on occasion. Be wary not to be greedy and add too many logs because logging is an input and output (I/O) operation and uses considerable resources over time.

  • Warning: These logs are often used to print anomalies that might merit an investigation but aren’t an immediate cause for concern.

  • Error: These logs indicate something went wrong and warranted further investigation. They typically print the error, trace, and ...