How to Turn Off Console Logging for Kestrel in .NET Core

This post is mostly a note to myself.

I am often annoyed with the amount of logging to the console that occurs when I start a Kestrel hosted application and I can never remember how to turn it off.

1public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
2    WebHost.CreateDefaultBuilder(args)
3    .ConfigureLogging(loggingBuilder => 
4        loggingBuilder.AddFilter<ConsoleLoggerProvider>(level => 
5            level == LogLevel.None))
6        .UseStartup<Startup>();
comments powered by Disqus

Related