Understand Logging in .Net Core in 3 Hours

Assumptions

  • We created a fresh web application in .NET Core and wanted to understand how Logging is already configured in the template code.
  • We have only 3 hours to understand Logging so that we can customize the logging behavior for our Project.

First 2 hours

Next 1 Hour

Conclusion

  • We also understand ILogger interface, ILoggerFactory, categories and default Log-Levels.
  • We can configure Logging behavior through appsettings.json file or command line arguments.

What’s next?

  • Understanding Log-scopes by enabling the IncludeScopes property as true.
  • Understanding Log filter rules.
  • Using third-party logging packages like NLog, Serilog etc.
  • Writing logs to cloud based monitoring services like Azure Application Insights.