liveBook · Manning

Category-specific rule

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

A category-specific rule is a filtering rule whose applicability is determined by the logger category or its prefix.

A category-specific rule filters log messages according to the logger category or a matching category prefix. For example, a Microsoft rule can require Warning-level logs while the default allows Debug. section 26.4

Logging selects one applicable rule: it prefers provider-specific rules, then the longest matching category prefix, then Default, and finally the global minimum level. Rules are selected rather than merged. section 26.4

Filtering framework logs

In appsettings.json, set Logging:LogLevel:Default to Debug, System to Warning, and Microsoft to Warning. This reduces framework noise while retaining detailed application logging.

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

How deep it goes
Explains prefix matching and rule precedence through a complete selection algorithm, but stops short of implementation internals.
Examples
Uses appsettings.json rules for Default, System, and Microsoft categories plus a console-provider selection example.
What it assumes
Assumes familiarity with log levels, providers, and logger categories.
What you can do after
Configure logging filters and diagnose which category or provider rule determines whether a message is written.
How it connects
Connects logging providers, log levels, logger categories, configuration, and provider-specific rules.

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.