Skip to content
BENIBIX Learn

Log Level

Infrastructure📈 Monitoring & ObservabilityTelemetry Signals

Also known as Logging Level, Log Severity, Severity Level

A tag on each log line that says how serious it is.

Think of it like

It is like the volume knob on a radio. Turn it down and you only hear the loud parts.

Example

On her laptop, Emma logs at DEBUG to see every step. On the live server she sets WARN, so only warnings and errors are kept.

Why it matters

The right level keeps logs small enough to search and cheap enough to store.

Definition

A log level says how serious a log line is. Common levels, from least to most serious, are DEBUG, INFO, WARN, ERROR and FATAL. You set a level for each program. Lines below that level are dropped, and lines at it or above are kept. The old syslog standard uses eight levels, numbered from 0 for emergency to 7 for debug.

Example code

python
import logging
logging.basicConfig(level=logging.WARNING)
logging.info("cart opened")      # dropped
logging.error("payment failed")  # kept: ERROR:root:payment failed
The level is set to WARNING. The info line is dropped and the error line is printed.
The set level is the line. All above it is kept, and all below it is thrown away.

Common mistake

Logging normal events as ERROR. Real errors then hide among hundreds of false ones.

Key takeaways

  1. 1
    A ladder. From chatty DEBUG up to FATAL.
  2. 2
    A cut-off. Lines below the set level are dropped.
  3. 3
    Different per place. Chatty on a laptop, quiet when live.