By Wolfgang Keller
Originally published 2024-05-01
Last modified 2024-05-01
What is a sensible set of logging levels? Let's have a look on what is used in practice. The starting point for this analysis is The only two log levels you need are INFO and ERROR | nicole@web [published 2024-04-22; visited 2024-05-01T01:17:22Z], also discussed on Hacker News: The only two log levels you need are INFO and ERROR | Hacker News [visited 2024-05-01T01:18:35Z].
Programming language | Rust | Python | Java | |||
---|---|---|---|---|---|---|
Library | tracing [visited 2024-05-01T01:29:35Z] | logging [visited 2024-05-01T01:29:48Z] | Log4j [visited 2024-05-01T01:29:59Z] | |||
Reference for levels | metadata.rs - source [visited 2024-05-01T01:37:40Z] | Logging HOWTO — Python 3.12.3 documentation [visited 2024-05-01T01:37:57Z] | Level (Apache Log4j API 2.23.1 API) [visited 2024-05-01T01:41:04Z] | |||
Type | Level | Description | Level | Description | Level | Description |
Critical/Fatal | - | - | CRITICAL |
A serious error, indicating that the program itself may be unable to continue running. | FATAL |
A fatal event that will prevent the application from continuing. |
Error | ERROR |
Designates very serious errors. | ERROR |
Due to a more serious problem, the software has not been able to perform some function. | ERROR |
An error in the application, possibly recoverable. |
Warn/Warning | WARN |
Designates hazardous situations. | WARNING |
An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’). The software is still working as expected. | WARN |
An event that might possible lead to an error. |
Info | INFO |
Designates useful information. | INFO |
Confirmation that things are working as expected. | INFO |
An event for informational purposes. |
Debug | DEBUG |
Designates lower priority information. | DEBUG |
Detailed information, typically of interest only when diagnosing problems. | DEBUG |
A general debugging event. |
Trace | TRACE |
Designates very low priority, often extremely verbose, information. | - | - | TRACE |
A fine-grained debug message, typically capturing the flow through the application. |