Files

1.2 KiB

Logging

Applies to a service that writes logs.

Levels

Log levels have a standard, RFC5424: { emerg: 0, alert: 1, crit: 2, error: 3, warning: 4, notice: 5, info: 6, debug: 7 }.

We follow a simplified variant:

  • 0: Error - Crash or equivalent catastrophe that needs fairly immediate action.
  • 1: Warning - The app works, for now, but something is wrong and needs to be fixed.
  • 2: Info - Nothing is wrong, but this is important information that should be possible to find in a production system.
  • 3: Verbose - Somewhat more detailed information than Info, suitable level to enable in a production system where more information is needed for a limited time.
  • 4: Debug - Suitable level for development. If enabled in production, the logs will be flooded.

Infrastructure

All logging in our applications goes to OTLP or stdout.

In our server environments, every log, trace and metric ends up in the environment's remote observability platform, such as Grafana Cloud or a self-hosted Grafana. A file on the server's disk is fine on the way there, such as a log a shipper tails, as long as it is bounded in size. It is never the only place a record lives.