liveBook · Manning

Filtering rule

As explained in ASP.NET Core in Action, 3e

A filtering rule is a logging configuration rule that determines whether messages meeting specified provider, category, and severity criteria are written.

A filtering rule decides whether a log message is written by comparing its severity with rules for the logger category and provider. This reduces production noise while preserving detailed local debugging output. section 26.4

A logging configuration can define several rules:

  • Set a default minimum level, such as Information. section 26.4
  • Raise the minimum for categories beginning with Microsoft, such as Warning, to suppress framework noise. section 26.4
  • Apply a provider-specific threshold, such as Error for console output; lower-level messages may still reach another provider. section 26.4

Provider-specific configuration

In appsettings.json, a default rule can use Debug, while the console provider keeps Microsoft messages at Warning and a file provider uses Information. For each provider, the most specific matching rule wins.

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains severity, category, provider, and specificity, but stops short of describing filtering internals.
Examples
Uses default, Microsoft-category, console-provider, and file-provider thresholds shown in configuration examples and filtering figures.
What it assumes
Assumes familiarity with logging messages and severity levels, while explaining provider and category filtering directly.
What you can do after
Configure ASP.NET Core logging so providers write only messages meeting selected severity and category rules.
How it connects
Connects logging configuration with log levels, logger categories, logger providers, and application settings.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.