liveBook · Manning

MinimumLevel

As explained in Building Web APIs with ASP.NET Core

MinimumLevel is the Serilog configuration section that defines the minimum severity accepted for log events, including optional source-specific overrides.

MinimumLevel sets the minimum severity Serilog accepts for log events. Configure a default level for every source, then add namespace-based overrides when one part of the application needs different detail. section 7.4.5

Configure application logging

Add a top-level Serilog section: "MinimumLevel": { "Default": "Information", "Override": { "Microsoft.AspNetCore": "Warning", "MyBGList": "Debug" } }. The same policy can be configured in Program.cs with lc.MinimumLevel.Is(...) and lc.MinimumLevel.Override(...). Serilog uses Verbose, Debug, Information, Warning, Error, and Fatal rather than Microsoft.Extensions.Logging.LogLevel names. section 7.4.5

Apply the policy deliberately:

  • Treat the MinimumLevel settings as applying to all sinks by default. section 7.4.5
  • Use restrictedToMinimumLevel when a particular sink needs its own threshold. section 7.4.5

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Explains JSON and Program.cs configuration, level-name differences, source overrides, and sink-specific restrictions.
Examples
Uses Microsoft.AspNetCore and MyBGList overrides plus MSSqlServer sink restrictions.
What it assumes
Assumes Serilog is configured and distinguishes its LogEventLevel values from Microsoft.Extensions.Logging.LogLevel.
What you can do after
Operate Serilog filtering through appsettings.json or Program.cs and tailor thresholds for sources or sinks.
How it connects
Connects Serilog configuration with log levels, namespace overrides, sinks, appsettings.json, and Program.cs.

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.