From the course: ASP.NET Core: Health Checks and Logging
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Understanding ILogger<T> - ASP.NET Core Tutorial
From the course: ASP.NET Core: Health Checks and Logging
Understanding ILogger<T>
- [Instructor] Let's talk about ASP.NET Core Logging. So we will create log entries, create a log, see different ways of doing that different ways to find a storage for those logs and a few extra features features. Most of them are based on one specific interface, the ILogger Interface. It's a generic interface and if you say, go to the studio or the studio code create a new class which is using that interface, and then ask the IDE to pre-populate your class with the methods you need to implement because they are part of the interface. You'll get three things. First of all, you will get a method called BeginScope which can be used to logically group certain log entries We'll see that in a bit. There's a property IsEnabled or well, and then there is one method called Log which can expect a lot of different properties and basically that's it. So you have an interface that requires us to implement a method…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
Understanding ILogger<T>1m 48s
-
What's in the template?6m 3s
-
Adding log entries5m 38s
-
Understanding log levels4m 48s
-
Configuring logging7m 40s
-
Logging to files7m 17s
-
Logging to Azure8m 12s
-
Using log scopes4m
-
Challenge: Add logging to the sample app1m 17s
-
Solution: Add logging to the sample app4m 26s
-
Summary of ASP.NET logging1m
-
-