CLOUD CONCEPT

Log Levels

Log levels classify application log events by severity or diagnostic detail so engineers can control what is recorded and prioritize investigation.

Cloud Concepts Hub →

What is Log Levels

Applications assign levels such as DEBUG, INFO, WARN, and ERROR to log events, while logging configuration determines which events are emitted or retained. Consistent levels make application behavior easier to understand, reduce unnecessary logging costs, and help engineers identify failures without losing useful operational context.

Log levels express the significance of an application event and help control logging verbosity. A common ordering, from most detailed to most severe, is TRACE, DEBUG, INFO, WARN, ERROR, and FATAL or CRITICAL. Frameworks differ in their supported names and numeric values, so applications should define and document their conventions rather than assume that every logging system uses the same scale.

TRACE typically captures fine-grained execution details, while DEBUG records information useful during diagnosis, such as retry decisions or selected configuration values. INFO describes expected operational events, such as a job starting or an order completing. WARN identifies an unexpected condition that does not currently prevent the operation from succeeding, such as a dependency timeout followed by a successful retry. ERROR indicates that an operation failed. FATAL or CRITICAL usually describes a condition that prevents a process or major component from continuing, although assigning that level does not itself terminate the process.

A logger's configured threshold normally includes that level and more severe levels. For example, an INFO threshold generally emits INFO, WARN, ERROR, and FATAL events while suppressing DEBUG and TRACE. Setting DEBUG therefore increases diagnostic detail; it does not mean recording only DEBUG events. Handler, collector, and destination filters can impose additional restrictions, so engineers must check the complete logging pipeline when an expected event is missing.

In cloud applications, use a logging library rather than scattered unstructured print statements. Emit structured records, commonly JSON, with a timestamp, severity, service name, deployment environment, message, and request or trace identifier. Include relevant application state, such as an operation name, attempt count, duration, or sanitized error code. For a payment request, an INFO event might record completion, a WARN event might describe a recoverable retry, and an ERROR event might record failure after retries are exhausted. Avoid repeatedly logging the same exception at every layer; capture it where useful context and the final outcome are known.

Production applications often use INFO as a baseline and temporarily enable DEBUG for a specific component during an incident. This is a starting point, not a universal rule: high-throughput applications may need more selective logging. Configure levels through deployment settings or controlled runtime configuration, and restore normal verbosity after troubleshooting. More verbose logging increases ingestion, storage, and query costs and may add CPU, serialization, and network overhead. Guard expensive diagnostic calculations because some logging APIs evaluate arguments even when the event is suppressed.

Centralized cloud logging services collect and search records, but collection alone does not guarantee correct severity classification. Configure severity in application instrumentation and preserve it through transport. Filtering a search to ERROR does not recover DEBUG events that the application never emitted, nor does it avoid the ingestion cost of records already collected. Establish retention and access controls separately from severity thresholds.

Severity must reflect application impact rather than exception presence alone. An expected validation rejection is not automatically an ERROR, and a recovered transient failure need not trigger paging. Build alerts from meaningful error rates, repeated failures, or customer impact rather than every individual error record. Never log credentials, tokens, or sensitive payloads at any level; DEBUG is not a security exemption. Finally, logs complement metrics and traces: severity helps prioritize events, while correlation identifiers connect those events across distributed requests.

Key aspects of Log Levels

Effective log levels combine consistent severity definitions, configurable verbosity, structured context, and operational controls that balance diagnostic value against noise, cost, and risk.

Consistent severity semantics

Define what each level means for the application and apply those definitions across components. Distinguish recoverable conditions from failed operations so warnings and errors remain useful.

Threshold-based verbosity

A configured minimum level generally permits that level and more severe events. Check logger, handler, collector, and destination settings when diagnosing missing records.

Structured diagnostic context

Record severity as a structured field alongside timestamps, operation details, and request or trace identifiers. This enables reliable filtering and correlation without parsing severity from free-form messages.

Controlled production diagnostics

Use an appropriate production baseline and temporarily increase detail for affected components during troubleshooting. Make changes controlled and reversible to limit overhead and excess data collection.

Cost and security boundaries

Suppress unnecessary detail before ingestion when possible, and configure retention independently. Redact secrets and sensitive data at every level, including DEBUG and TRACE.

Actionable alerting

Use severity to support detection, but combine it with frequency, duration, and operational impact. A single ERROR event does not necessarily justify paging an engineer.

Cloud services for Log Levels

Applications running in Lambda or Amazon ECS assign severity and diagnostic context before emitting records. CloudWatch Logs centralizes those records for investigation, and metric filters can feed CloudWatch alarms when selected error patterns occur. Where broader indexed analysis is needed, a configured ingestion pipeline can also deliver logs to Amazon OpenSearch Service for cross-service searches and dashboards. Across these paths, preserve severity and correlation identifiers, control verbosity near the source, and configure retention and access independently of log levels.

AWS Lambda image AWS Lambda

Sends function logs to CloudWatch Logs when the execution role has the required permissions. Advanced logging controls support separate application and system log-level settings, with application-level filtering requiring supported JSON-formatted log records.

Open AWS Lambda →
Amazon OpenSearch Service image Amazon OpenSearch Service

Indexes log records for searches, aggregations, and dashboards based on severity and other fields. Consistent field mappings and severity conventions help engineers compare failures across services.

Open Amazon OpenSearch Service →