I did this:
public static IWebHost BuildWebHost(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseUrls("http://0.0.0.0:5000")
.ConfigureLogging(ConfigureLogging)
.Build();
}
private static void ConfigureLogging(WebHostBuilderContext hostingContext, ILoggingBuilder logging)
{
logging.ClearProviders();
}
And my appsettings.json
:
{
}
But still.. I get exceptions logged to Console
- can somebody explain why? Pointers?
You can configure the logging while creating the webhost like this
private static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(config => {
config.ClearProviders();
})
.UseKestrel()
.UseStartup<Startup>();
The config.ClearProviders() will remove all logging service and only produce minimal information
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