ClearProviders removes every logging provider currently configured on the logging builder. WebApplication.CreateBuilder initially supplies Console, Debug, EventSource, and Windows-only EventLog providers, so clearing comes before adding back only the providers the application should retain. section 7.2.4
var builder = WebApplication.CreateBuilder(args); builder.Logging .ClearProviders() #1 .AddSimpleConsole()#2 .AddDebug(); #3
Use ClearProviders first, then chain AddSimpleConsole and AddDebug to create an explicit provider configuration. section 7.2.4
Keeping selected providers
In Program.cs, clear the defaults, add the simple console provider, and add the debug provider. Launch the application in Debug mode, execute BoardGamesController.Get, and inspect the hosting command prompt to verify the custom log message. section 7.2.4
