Course contentsShow
← Software Engineering
Lesson 1120 of 1,93334. Logging and ObservabilityFree lesson

Log Levels and Severity

Using DEBUG, INFO, WARN, ERROR, and FATAL levels appropriately to categorize log messages by importance.

Log Levels and Severity

What you'll learn: How to categorize log messages by importance using standard severity levels to make your logs actionable and filterable.

The Problem: Signal vs Noise

When your application runs, it generates thousands of log messages. Without organization, finding critical issues in this sea of information is like searching for a needle in a haystack. Log levels solve this by marking each message with its importance.

The Standard Five Levels

Think of log levels like a traffic light system for your application's health:

DEBUG

The most verbose level. Use for detailed diagnostic information useful during development and troubleshooting. Example: "User object created with ID 12345" or "Entering calculateDiscount() method."

INFO

General informational messages about normal operation. Example: "Application started successfully" or "User logged in."

WARN

Something unexpected happened, but the application can continue. This is your "yellow flag" — not broken yet, but pay attention. Example: "Cache miss, falling back to database" or "API response took 3 seconds (threshold: 2s)."

ERROR

An operation failed, but the application as a whole can still run. Example: "Failed to process payment for order #789" or "Unable to send email notification."

FATAL

The application cannot continue and must shut down. Reserved for catastrophic failures. Example: "Database connection pool exhausted" or "Critical configuration file missing."

Choosing the Right Level

Ask yourself: "If this were the only log message I saw, how urgently would I need to respond?" FATAL means "wake me up at 3am." DEBUG means "only show me if I'm actively investigating."

Key Takeaway: Log levels transform logs from noise into a filterable, actionable monitoring tool — use DEBUG for deep diagnostics, INFO for normal operations, WARN for concerning patterns, ERROR for failures, and FATAL for catastrophic issues.