ASP.NET Core: Logging with log4net
1h 13mAdvanced2021-05-17
Authors

Ervis Trupja
Full-Stack .NET Web Developer with a mathematical background
Course details
Logging frameworks like log4net can help standardize and streamline the process of event logging: helping developers control which events are output and where to output them. This course teaches a real-world, project-based approach to event logging for ASP.NET Core applications with log4net. Instructor Ervis Trupja explains the benefits of using a logging framework and the options available to you. He then shows how to set up the log4net framework for console, web API apps, and MVC apps, and how to log to different mediums: a regular log file, a rolling file, and a SQL database. Plus, earn how to create a custom exception handler and configure it in the middleware to log exceptions globally.
Skills covered
ASP.NETBack-End Web DevelopmentFull-Stack Web DevelopmentFront-End Web DevelopmentWeb DevelopmentMicrosoftOne-Off
Concepts
0. Introduction
- 01 - Leverage the power of logging frameworks
- 02 - What you should know
1. Getting Started with Logging
- 03 - What is a logging framework
- 04 - Why use a logging framework
- 05 - What are the common logging frameworks
2. Setting Up log4net in .NET Core
- 06 - Logging levels and appender types
- 07 - Setting up log4net in .NET Core console apps
- 08 - Adding the log4net.config file
- 09 - Logging to the console with colors
- 10 - Setting up log4net in .NET Core web API apps
- 11 - Logging to a file
- 12 - Logging to a rolling file
- 13 - Challenge - Setting up log4net in .NET Core MVC apps
- 14 - Solution - Setting up log4net in .NET Core MVC apps
- 15 - Logging to an SQL database
3. Setting Up a Global Exception Logger
- 16 - Setting up an exception handler middleware
- 17 - Log all unhandled exceptions to a file
- 18 - Log unhandled exceptions using a filter
- 19 - Handling and logging 404s in MVC
Conclusion
- 20 - Continuing on with logging