In my Blazor WebAssembly client, I have this appsetting:
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
}
}
So why do I still get endless cruft in my browser console when running locally?
info: System.Net.Http.HttpClient.MyNamedClientName.ClientHandler[101]
Received HTTP response headers after 190ms - 200 blazor.webassembly.js:1:9737
info: System.Net.Http.HttpClient.MyNamedClientName.LogicalHandler[101]
End processing HTTP request after 193ms - 200 blazor.webassembly.js:1:9737
info: System.Net.Http.HttpClient.MyNamedClientName.ClientHandler[101]
Received HTTP response headers after 267ms - 200 blazor.webassembly.js:1:9737
info: System.Net.Http.HttpClient.MyNamedClientName.LogicalHandler[101]
End processing HTTP request after 274ms - 200 blazor.webassembly.js:1:9737
info: System.Net.Http.HttpClient.MyNamedClientName.ClientHandler[101]
Received HTTP response headers after 316ms - 200 blazor.webassembly.js:1:9737
info: System.Net.Http.HttpClient.MyNamedClientName.LogicalHandler[101]
End processing HTTP request after 319ms - 200
How can I turn off these info lines?
In a .NET 5 latest version in case you don't want those to be shown on blazor client side, you can do this in your Main method of startup class.
builder.Logging.SetMinimumLevel(LogLevel.None);
using Microsoft.Extensions.Logging;
...
builder.Logging.AddConfiguration(
builder.Configuration.GetSection("Logging"));
You have to configure the logger in the builder.
Reference: https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/configuration?view=aspnetcore-3.1#logging-configuration
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With