Showing posts with label ILogger. Show all posts
Showing posts with label ILogger. Show all posts

Monday, April 6, 2020

Asp.Net Core Console logging

In the previous post we saw the various Interfaces and Classes provided by Asp.Net Core to support logging, in this post we shall see on how to enable Console logging in an Asp.Net Core Web API application.

To enable a specific type of log we need to add the log provider to the startup. To add a provider we need to call the provider's Add extension method under ConfigureLogging in Program.cs. To Add a console log provider we need to add the following to the Program.cs

Asp.Net Core Logging

Logging is a crucial part of any application, especially for large applications logging is very important in production environment where debugging is not straight forward. The Asp.Net Core framework provides built-in support for logging.

In Asp.Net Core logging support is provided by the Microsoft.Extensions.Logging namespace. This namespace provides the following classes and interfaces to support Logging.