Logging is the practice of recording discrete events from a system so you can inspect what happened later.

Logs are usually text records with a timestamp and some context, such as:

  • An error message
  • A request being handled
  • A service starting or stopping
  • A dependency timing out

Why people use it

Logging helps answer questions such as:

  • What happened right before an error?
  • Which code path ran?
  • What inputs were received?
  • What state did the system have when something failed?

Compare

Logging is one of the three main signals in Observability.

  • Metrics tell you how much or how often
  • Traceability tells you where a request went
  • Logging tells you what happened at a specific point in time

Logs are often correlated with Metrics and Traceability using IDs, timestamps, and request metadata.