Course contentsShow
← System Design
Lesson 1128 of 1,91929. Observability: LoggingFree lesson

Log Levels and Severity

Learning standard log levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL) and when to use each severity appropriately.

Log Levels and Severity

What You'll Learn

You'll learn how to classify log messages using standard severity levels and when to apply each one to balance debugging power with production noise.

The Six Standard Log Levels

Think of log levels like medical triage: not every symptom needs an ambulance. Similarly, not every log message deserves the same urgency or attention.

TRACE

The most granular level. Use for following execution flow line-by-line, like "entered method X with parameter Y." Typically disabled in production due to extreme volume.

DEBUG

Detailed diagnostic information useful during development. Shows internal state, variable values, and decision points. Usually disabled in production but invaluable when troubleshooting specific issues.

INFO

Normal operational messages documenting the system's story: "User logged in," "Payment processed," "Cache refreshed." The default production level—enough to understand what happened without overwhelming detail.

WARN

Something unexpected but recoverable occurred. The system continues functioning, but attention may be needed: "API rate limit approaching," "Fallback cache used," "Retry attempt 2 of 3." Warnings are your early warning system.

ERROR

A failure occurred that prevented a specific operation from completing: "Failed to process payment," "Database connection lost," "Invalid user input rejected." These require investigation but don't crash the service.

FATAL

Critical failures that force service shutdown or indicate severe corruption: "Out of memory," "Configuration file missing," "Database unreachable on startup." These demand immediate response.

Choosing the Right Level

The key is signal-to-noise ratio. In production, you want INFO and above to give you operational visibility without drowning in details. DEBUG and TRACE should be selectively enabled when hunting specific bugs.

Key Takeaway: Log levels let you control verbosity and filter what matters—use INFO for operational visibility, WARN for potential issues, ERROR for actual failures, and reserve DEBUG/TRACE for deep investigation.