From the course: ASP.NET Core: Health Checks and Logging
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Adding log entries - ASP.NET Core Tutorial
From the course: ASP.NET Core: Health Checks and Logging
Adding log entries
- [Narrator] It is now time for us to create our first block entries. Let's start with the web application we have and there let's have a look at our index cshtml razor page and the associated class index.cshtml.cs and in there, you see that we already have the boiler plate code that Visual Studio gave us. So we already have _logger and we can use that for instance, in the OnGet methods. So when there's a get request for this page we could just do a _logger. and then we have a couple of methods, the log method which you already saw on the slide at the interface but also something like LogCritical or LogError or LogInformation. And that has to do with different so-called "Log levels". You just use LogInformation, so far and have a look at log levels a little bit later. And then if you have a look at that, you see for overloads and let's just start with the most simple version. We just provide a log message and the log…
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)
-