Skip to main content

Logging Levels in EWA

This document provides an overview of logging levels and recommendations for configuring logging in the EWA system. Logging is a crucial tool for monitoring system health, diagnosing issues, and ensuring smooth operation. However, excessive or improperly managed logging can lead to unnecessary resource consumption, such as increased database load, slower system performance, and cluttered logs that obscure important information.

To achieve an effective balance, this guideline explains the purpose of each logging level and offers recommendations for their use in different environments.

What Are Logging Levels?

Logging levels categorize the significance of logged events, helping to prioritize what information should be recorded. Each level serves a specific purpose:

  • Fatal: Represents critical errors that cause the system to stop functioning.
  • Error: Captures significant issues affecting functionality that need to be addressed.
  • Warn: Highlights potential problems that could escalate without intervention.
  • Info: Provides details on normal operations for understanding system behavior.
  • Debug: Offers in-depth technical details for troubleshooting during development or issue resolution.
  • Trace: Delivers extremely granular information for tracing every step in the application, useful for diagnosing complex problems.

General Guidelines for Logging Levels

1. Always Log: Critical Levels

These two levels are essential for maintaining system reliability and should always be logged:

Fatal

  • Purpose of Logging: Fatal errors indicate severe issues that cause the system to crash or become non-functional.
  • Operational Usage: Logging fatal events ensures immediate attention to resolve disruptions that could halt business operations.

Error

  • Purpose of Logging: Errors indicate problems that impact the functionality or performance of the system, such as failed processes or unavailable services.
  • Operational Usage: Monitoring errors allows teams to detect issues promptly and prioritize their resolution.

2. Typically Log: Potential Issues

This level provides early warnings of potential problems and should generally be logged unless resource constraints dictate otherwise.

Warn

  • Purpose of Logging: Warnings signal potential risks or unusual activity, such as nearing resource limits or deprecated API usage.
  • Operational Usage: Warnings allow teams to take preventative action before problems escalate into critical errors.

3. Log Selectively: Informational and Debugging Details

These three levels provide additional insights but should be used selectively to avoid overwhelming log storage and processing.

Info

  • Purpose of Logging: Informational logs provide an overview of system activities, such as successful user logins or routine task completion.
  • Operational Usage: Info-level logs are valuable for analyzing trends, identifying patterns, and auditing operations. In production, excessive info logs can consume resources and may need to be restricted.

Debug

  • Purpose of Logging: Debug logs are highly detailed and used for diagnosing problems during development or troubleshooting.
  • Operational Usage: Debug logging is typically disabled in production environments to minimize performance impact but can be enabled temporarily for specific investigations.

Trace

  • Purpose of Logging: Trace logs capture every step of the system's operations, providing the most granular level of detail.
  • Operational Usage: Trace logging is only appropriate for targeted debugging sessions, as it generates large amounts of data and can strain system resources.

Recommendations for Production Environments

To maintain system stability and efficiency in production environments while ensuring visibility into critical events:

  • Always log: Fatal, Error, and Warn.
  • Log selectively: Info, Debug, and Trace, depending on the need for insights and resource availability.

By focusing on Fatal, Error, and Warn levels, production environments remain manageable while providing critical insights without overwhelming logging systems.

Recommendations for Testing Environments

In testing environments, the focus is on diagnosing issues and understanding system behavior under various conditions:

  • Always log: Fatal, Error, Warn, and Info.
  • Log selectively: Debug and Trace

By logging Info, Debug, and Trace levels more extensively in testing, teams gain a comprehensive view of the system, enabling better preparation for deployment to production.