A log category identifies the component that generated a message and determines which logging configuration applies. ILogger<T> conventionally derives the category from T, while ILoggerFactory can create one from an explicit string. section 15.3.1 section 15.3.3
A class such as Population produces the Platform.Population category. Logging configuration matches that category directly, by its namespace prefix such as Platform, or through the Default entry when no more specific match exists. section 15.3.3
Use categories to control the detail emitted by different parts of an application:
- Set a minimum level such as Trace, Debug, Information, Warning, Error, Critical, or None. section 15.3.3
- Inject ILogger<Population> into an endpoint so its messages carry the Population-derived category. section 15.3.1
- Use app.Logger in Program.cs for the application category, or create an explicit Pipeline category through ILoggerFactory. section 15.3.1
Filtering routing diagnostics
Set Microsoft.AspNetCore.Routing to Debug while leaving Microsoft.AspNetCore at Warning. Routing diagnostics then appear alongside application messages without increasing every Microsoft category's verbosity. section 15.3.3
Listing 15.24 Configuring the appsettings.Development.json file in the Platform folder
{
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Routing": "Debug"
}
}
}
Shows a focused appsettings.Development.json configuration that raises routing diagnostics without broadly enabling detailed ASP.NET Core logging. section 15.3.3

