Log providers

Log providers are the bridge between the application code that write logs and the output medium to which the logs will be written. There are a few providers that offer out-of-the-box solutions, such as Console, Debug, EventSource, and more that you can find at https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/?view=aspnetcore-2.1#built-in-logging-providers. There are also third-party providers, such as serilog (https://github.com/serilog/serilog-aspnetcore) and NLog (https://github.com/NLog/NLog.Extensions.Logging), that give more control about the logging configuration and destinations.

By default, the ASP.NET Core logging framework sets the logging providers to Debug (the output debug window) and Console (the stdout and stderr streams). The default implementation is similar to what we could have written manually in the creation of the WebHostBuilder in the Program class:

public class Program
{
...

public static IWebHostBuilder CreateWebHostBuiler(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.ConfigureLogging(cfg =>
{
cfg.AddConsole();
cfg.AddDebug();
})
.UseStartup<Startup>();
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.185.96