Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Created May 11, 2021 19:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj-choudhari-git/757f9d88931620a11c41d800ac9df072 to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/757f9d88931620a11c41d800ac9df072 to your computer and use it in GitHub Desktop.
.NET Core Web Application - Customize Default Logging Providers for Web App
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
webBuilder.ConfigureLogging((hostingContext, loggingBuilder) =>
{
loggingBuilder.ClearProviders();
loggingBuilder.AddJsonConsole(options =>
{
options.IncludeScopes = false;
options.TimestampFormat = "hh:mm:ss ";
options.JsonWriterOptions = new JsonWriterOptions
{
Indented = true
};
});
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment