From the course: ASP.NET Core: Health Checks and Logging
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
What's in the template? - ASP.NET Core Tutorial
From the course: ASP.NET Core: Health Checks and Logging
What's in the template?
- [Instructor] Let's have a look how we can use the ILogger interface in our ASP.NET Core application. First of all, of course, we need a project. If you set up a new project the template we want to use is ASP.NET Core web project, and then we can either use an ASP.NET Core web application or an API application because that's based on ASP.NET Core as well. We'll have a look at the code that is generated but basically in program.cs, we will have a call to create default builder, and what that does is it provides us with a couple of log providers, they're already there, we can use them right away. The only thing which is missing or basically which we need to know is how can we access those loggers? What we can do is in the constructor of say our Razor Page or of our controller, we can use dependency injection. So we just in the constructor, provide an argument of type ILogger, and then that is dependency injected into…
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
-
-
-
(Locked)
Understanding ILogger<T>1m 48s
-
(Locked)
What's in the template?6m 3s
-
(Locked)
Adding log entries5m 38s
-
(Locked)
Understanding log levels4m 48s
-
(Locked)
Configuring logging7m 40s
-
(Locked)
Logging to files7m 17s
-
(Locked)
Logging to Azure8m 12s
-
(Locked)
Using log scopes4m
-
(Locked)
Challenge: Add logging to the sample app1m 17s
-
(Locked)
Solution: Add logging to the sample app4m 26s
-
(Locked)
Summary of ASP.NET logging1m
-
(Locked)
-