Provider-specific configuration and filters

Each logging provider can be configured independently. For example, if you wish to enable all logs in the Debug output, but want to filter the Console output to only display Warning and above, here is how you can configure it in the appsettings.json file:

{
...
"Logging": {
"Debug": {
"LogLevel": {
"Default": "Information"
}
},
"Console": {
"LogLevel": {
"Default": "Warning"
}
},
"LogLevel": {
"Default": "Debug",
"Microsoft.AspNetCore": "Warning"
}
}
}

The Console and Debug providers are helpful when running locally, but in production, you need a more powerful provider that can also store the logs that are coming from all of your services (and their instances) in a centralized way to allow querying of them at a later time. There are a few options you can choose from for centralized logging, such as Loggly, Logz.io, Application Insights, and so forth, each with their own set of features and pricing models. In this book, we'll use Application Insights, because it's both powerful and easy to integrate with the ASP.NET Core application.

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

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