serilog logging levels diagram

April 11, 2026

Sabrina

Serilog Log Levels Explained for UK Devs

🎯 Quick AnswerSerilog log levels categorize the severity of logged events, allowing developers to filter and prioritise information. The hierarchy ranges from Trace (most verbose) to Fatal (most critical), with levels like Information and Warning used for normal operation and potential issues respectively. Effective use ensures relevant data capture.

Serilog Log Levels: A UK Developer’s Practical Guide

For .NET developers in the UK and across Europe, mastering Serilog’s log levels is not just about recording events; it’s about intelligently filtering, prioritising, and understanding the flow of your application. Choosing the right log level for each message ensures that your logs are informative without being overwhelming, saving valuable debugging time and system resources.

(Source: nlog-project.org)

This article provides a comprehensive overview of Serilog’s distinct log levels, explaining their purpose, typical use cases, and how to strategically apply them within your .NET applications, with a specific nod to common practices and considerations for the UK/EU development scene. We’ll cover everything from the most verbose trace messages to the critical fatal errors.

Table of Contents

What are Serilog Log Levels?

Serilog log levels are categorisations used to describe the severity or importance of a logged event. They allow developers to filter log messages, ensuring that only relevant information is captured and stored based on the current application state or environment. This systematic approach is vital for managing the volume of logs generated by modern applications.

In essence, each log message is assigned a level, such as `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Fatal`. When configuring Serilog, you typically set a minimum level. Any log message with a level equal to or higher than this minimum will be processed; messages below it will be discarded. This filtering mechanism is key to efficient logging.

Understanding the Serilog Log Level Hierarchy

Serilog log levels operate on a hierarchy, where each level is considered more severe than the one preceding it. Understanding this order is crucial for setting appropriate minimum levels and ensuring you capture the right events. The standard hierarchy, from least to most severe, is:

Hierarchy (Least to Most Severe):

  • Trace
  • Debug
  • Information
  • Warning
  • Error
  • Fatal
Typical Minimum Level Usage:

  • Production: Information, Warning, Error, Fatal
  • Staging: Debug, Information, Warning, Error, Fatal
  • Development: Trace, Debug, Information, Warning, Error, Fatal

This structure allows for granular control. For instance, setting the minimum level to `Information` means `Trace` and `Debug` messages will be ignored in production, preventing excessive log file sizes. Conversely, during development, you might set it to `Trace` to capture every detail for debugging.

Trace Level: The Deepest Dive into Diagnostics

The `Trace` level is the most verbose. It’s intended for extremely detailed diagnostic information that might be useful for pinpointing specific issues during in-depth troubleshooting. These logs typically contain information about method entries and exits, variable states, and internal processing steps.

In my experience, using `Trace` extensively in production systems can lead to enormous log files, impacting performance and storage costs. It’s best reserved for development or very specific, short-term debugging sessions in lower environments. Think of it as the developer’s magnifying glass.

Debug Level: Essential for Development and Testing

The `Debug` level is slightly less verbose than `Trace` but still provides detailed information useful for debugging and testing. It often includes information about program flow, variable values, and intermediate results that help developers understand how the application is behaving during specific operations.

This level is invaluable during the development cycle. When building features or fixing bugs, `Debug` logs help trace the execution path and identify logical errors. It’s common practice to enable `Debug` logging in local development environments and staging servers for proactive issue detection before deployment to live users.

Information Level: Tracking Normal Application Flow

The `Information` level is designed for messages that describe the normal operation of the application. These logs indicate the progress of significant processes, such as a user logging in, a request being processed, or a background job completing. They provide a high-level overview of what the application is doing.

For production environments, `Information` is often the recommended minimum log level. It strikes a good balance, providing enough context to understand application behaviour and track key events without generating excessive log data. For example, logging “User ‘Alice’ logged in successfully” at this level is highly informative.

Warning Level: Highlighting Potential Problems

Log messages at the `Warning` level indicate that something unexpected happened, or a potential problem occurred, but the application can still continue to function. These might include situations like a temporary network issue, a deprecated feature being used, or a resource running low.

These warnings are crucial for proactive maintenance. They alert you to situations that could lead to errors if not addressed. For instance, a warning about a slow database query might not be an error now, but it could become one under heavy load. Monitoring these is key for system stability.

Error Level: Capturing Application Failures

The `Error` level is reserved for events where an error occurred and the application could not handle it, leading to a failure in a specific operation. This typically includes unhandled exceptions that disrupt the normal flow of execution for a particular task or user request.

When an `Error` is logged, it signifies a problem that requires immediate attention. These logs are critical for diagnosing and resolving bugs. For example, logging an exception like `NullReferenceException` at this level clearly indicates a programming flaw that needs fixing.

Fatal Level: Indicating Catastrophic System Failure

The `Fatal` level represents the most severe type of event: a critical application or system failure that will likely cause the application to terminate. These are typically unrecoverable errors, such as a catastrophic database connection failure or a critical resource exhaustion.

When a `Fatal` error is logged, it’s a signal that the application is no longer operational or is in a severely degraded state. These events demand immediate investigation and resolution, as they directly impact service availability. For instance, a `OutOfMemoryException` on a critical service would warrant a `Fatal` log.

Setting Minimum Log Levels Effectively

Choosing the appropriate minimum log level is a balancing act. A common strategy is to set different minimum levels for different environments. For production, starting with `Information` or `Warning` is often wise. You can then temporarily increase this to `Debug` or `Trace` if you need to diagnose a specific, intermittent issue, and then reduce it again.

The `.MinimumLevel()` configuration option in Serilog is where this is set. For example, in your `appsettings.json` or programmatically:

// Programmatic configuration example
Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Information() // Set minimum level to Information
    .WriteTo.Console()
    .CreateLogger();

Choosing Levels for Different Environments (UK/EU Focus)

In the UK and across Europe, where data privacy regulations like GDPR are paramount, careful consideration of log content is essential. While Serilog’s levels help filter severity, they don’t inherently filter sensitive data. However, by using lower levels like `Trace` and `Debug` only in controlled development or staging environments, you minimise the risk of accidentally logging personal data to production systems.

For production systems serving users in the EU, it’s prudent to set the minimum level to `Information` or `Warning`. This ensures that only essential operational data is logged, reducing the potential for privacy breaches. If detailed debugging is required, it should be performed in isolated, secure environments with appropriate access controls, rather than on live production servers.

Expert Tip: Consider using Serilog’s `Filter` functionality for more complex scenarios, such as excluding logs from specific namespaces or methods even if they meet the minimum level, further refining your log data.

Best Practices for Serilog Log Levels

Applying Serilog’s log levels effectively requires a consistent approach. Here are some best practices:

  • Be Consistent: Define clear guidelines within your team on what constitutes an `Information` versus a `Warning` log.
  • Use Levels Appropriately: Don’t log `Error` messages for minor issues; use `Warning` or `Information` instead. Reserve `Fatal` for true emergencies.
  • Environment-Specific Configuration: Tailor minimum levels and destinations (e.g., file, database, Seq, Application Insights) based on the environment (development, staging, production).
  • Audit Log Content: Regularly review your log output to ensure you aren’t logging sensitive data unnecessarily, especially in production.
  • Leverage Output Templates: Use Serilog’s flexible output templates to structure your log messages and include relevant context, like the log level itself, timestamps, and other metadata.

A common mistake is to set the minimum level too low in production, leading to performance degradation and excessive storage costs. Conversely, setting it too high can mean missing critical debugging information when issues arise.

For applications that need to scale efficiently, proper log level management is as critical as database optimisation. A study by Sentry in 2023 indicated that inefficient logging can contribute to as much as 10-15% of unexpected application resource consumption.

Frequently Asked Questions

What is the default Serilog log level?

Serilog itself does not enforce a default minimum log level. You must explicitly configure one when setting up your `LoggerConfiguration`. If no minimum level is set, it might default to `Verbose` (which includes `Trace`), but this is not guaranteed and depends on the specific configuration setup.

How do I set the minimum log level in Serilog?

You set the minimum log level using the `.MinimumLevel()` method on the `LoggerConfiguration` object. For example, `.MinimumLevel.Warning()` sets the minimum level to `Warning`. You can also use `.MinimumLevel.Override(“Namespace”, LogEventLevel.Debug)` to set different minimums for specific namespaces.

Should I use Trace logs in production?

Generally, no. `Trace` logs are extremely verbose and can significantly impact application performance and storage costs. They are best used during development or for short, targeted debugging sessions in non-production environments. Always reduce to `Information` or `Warning` for production.

What is the difference between Error and Fatal in Serilog?

An `Error` log indicates a specific operation failed, but the application might continue running. A `Fatal` log signifies a critical failure that will likely cause the application to crash or become completely unusable, requiring immediate intervention.

How does Serilog handle different log levels for different sinks?

Serilog allows you to configure different minimum levels for each ‘sink’ (output destination like Console, File, Seq, etc.). You can use `.WriteTo.Console(restrictedToMinimumLevel: LogEventLevel.Debug)` to send debug logs to the console while only sending information logs to a file.

Optimise Your Application’s Observability Today

By understanding and correctly implementing Serilog’s log levels, you gain powerful control over your application’s diagnostic output. This knowledge empowers you to build more robust, maintainable, and observable .NET applications, whether you’re developing in Manchester, Berlin, or anywhere else. Start refining your logging strategy today to save time and resources.

Editorial TeamOur team creates thoroughly researched, helpful content. Every article is fact-checked and updated regularly.
🔗 Share this article