Log Levels and Severity
You'll learn: How to classify log messages by importance using standard severity levels.
What Are Log Levels?
Not all log messages are equally important. A typo in a configuration file deserves more attention than a routine "service started" message. Log levels are standard categories that classify how urgent or significant a log entry is—like labeling emails as "urgent," "normal," or "FYI."
Most logging systems use five standard levels, from least to most severe:
DEBUG
The most detailed level—traces of what's happening internally. Use this during development to understand program flow. Example: "Entering function calculateTax with value 150."
INFO
General informational messages about normal operations. These confirm things are working as expected. Example: "User logged in successfully" or "Database connection established."
WARN
Something unexpected happened, but the system can continue. It's not an error yet, but pay attention. Example: "API response took 8 seconds (slower than usual)" or "Disk usage at 85%."
ERROR
Something failed, but the application can still run (perhaps in degraded mode). Example: "Failed to process payment for order #12345" or "Unable to connect to cache server."
FATAL (or CRITICAL)
The application cannot continue—it's about to crash or has entered an unrecoverable state. Example: "Out of memory" or "Core database unreachable—shutting down."
Why This Matters
Using consistent log levels lets you filter intelligently. In production, you might only capture WARN and above to avoid drowning in DEBUG noise. During troubleshooting, you temporarily enable DEBUG for detailed investigation.
Key Takeaway: Log levels (DEBUG, INFO, WARN, ERROR, FATAL) standardize message severity, helping you filter signal from noise and respond appropriately to different situations.