A logging level classifies an event by severity and controls whether the application records it. The .NET ILogger API provides named shortcuts such as LogInformation and LogError, plus a generic Log method that accepts an explicit LogLevel value. section 7.2.1 section 7.2.2
The Microsoft.Extensions.Logging LogLevel enumeration orders levels from least to most severe:
- Trace: low-level internal activity, generally unsuitable when sensitive details could be exposed. section 7.2.2
- Debug: development details such as variable values, stack traces, and execution context; disable it in production. section 7.2.2
- Information: normal application activity; Warning: abnormal behavior that does not interrupt normal flow. section 7.2.2
- Error: a noncritical event that hinders a task; Critical: an event that prevents startup or causes an unrecoverable crash. section 7.2.2
- None: disables logging. section 7.2.2
A configured minimum level determines which events pass for each category. Setting Default to Information records Information and higher levels, while a category such as Microsoft.AspNetCore can override it with Warning. Child categories inherit parent settings unless a more specific category overrides them. section 7.2.3
Configure and verify a level
Set Default to Warning and the application category MyBGList to Information in appsettings.json. Add _logger.LogInformation("Get method started.") to the controller, run the project in Debug mode, invoke the GET endpoint through SwaggerUI or its URL, and inspect the Visual Studio Output window. The entry shows the controller category, Information level, and message. The same configuration also affects framework and third-party components using ILogger. section 7.2.1 section 7.2.3
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
Shows the JSON shape for a default minimum level and a more restrictive Microsoft.AspNetCore category override. section 7.2.3








