log level
A label on each log message saying how serious it is, from debug and info up to error, critical and emergency.
In more detail
Common levels are debug, info, warning and error, and a program configured at one level writes that level and everything more serious. Production usually logs less detail than development or staging.
Examples
log_level: info in group_vars/staging.yml is a typical per-environment variable.Linux uses the eight syslog priorities, numbered 0 (emerg) to 7 (debug). journalctl -p err shows priority 3 and more severe. The kernel's loglevel boot parameter controls which kernel messages reach the console.LOG_LEVEL=DEBUG python3 levels.py shows the cache lookup; LOG_LEVEL=ERROR shows only the lost order.Related terms
- group_vars — A directory whose files hold variables for inventory groups, one file or folder per group, named exactly after the group.
- environment overlay — Keeping one shared playbook and putting the values that differ between environments in separate variable files, one per environment.
- log — A time-stamped record of an individual event in a system, such as one request being handled; structured logs record it as named fields rather than free text.
- journald — The systemd logging service that collects messages from the kernel, services and programs into a structured, indexed journal.
- journalctl — The command that reads the systemd journal, where services on a Linux host write their logs.
- kernel command line — The list of options the bootloader passes to the kernel at start-up, such as root=/dev/sda2 quiet, which shapes early boot.
- DEBUG — The most detailed log level, for values and branches that only help a developer reproducing a fault.
- INFO — The default log level, for normal events a business would recognise, such as an order accepted or a job finished.
- WARN — The log level for a problem the system recovered from by itself, such as a retry that succeeded or a fallback that was used.
- ERROR — The log level for work that was actually lost: a request failed and the user did not get what they asked for.
- environment variable — A named setting such as PORT=8000 that a program reads from its surroundings when it starts.
- threshold — A chosen limit that a value is compared against to decide whether something should happen, such as an alert firing.
Taught in
- Host Groups And Host Variables — Ansible Configuration Management at Scale
- Environment Specific Configuration — Ansible Configuration Management at Scale
- Observability: Logs, Metrics, Traces — Modern API Architecture: REST, GraphQL & gRPC
- Booting: GRUB, The Kernel Command Line And initramfs — Linux Fundamentals & Systems Administration
- Your Own Unit, And Reading journald — Linux Fundamentals & Systems Administration
- Structured Logging And Why Text Fails — Full-Stack Observability: Metrics, Tracing & Logging
- Log Levels Done Properly — Full-Stack Observability: Metrics, Tracing & Logging
- Fifty Four In, Two Out: Debugging A Pipeline — OpenTelemetry Certified Associate (OTCA) Exam Prep
- Observability Sprint: One Failed Checkout — Prometheus Certified Associate (PCA) Exam Prep
- Verbose Logging: TF_LOG And Friends — HashiCorp Terraform Associate (004) Exam Prep
References
- Python logging: logging levels
- OpenTelemetry: Logs
- man7: syslog(3)
- man7: journalctl(1)
- Python logging module
- OpenTelemetry: logs data model
- RFC 5424: the Syslog protocol