This video covers the new built-in logging capabilities in ASP.NET Core.
- Another change from prior versions of ASP.NET is the fact that standard logging is built-in to ASP.NET CORE. It provides an ILoggerFactory, available in the Startup Configure Method, and you can additional built-in or third-party logging providers as you find necessary. And then this LoggerFactory is available through injection using ILogger<T>, and you just have to write to the logger once, and as many providers as you have added will get the log messages.
There is a change in 2.0, and it's logging is incorporated into the DI system by default and it's configured in Program.cs instead of Startup.cs. But we will cover that in Chapter Two. So, to look at logging in our sample application. So we already saw this in the previous section, where we have the LoggerFactory getting injected into Configure and then we're adding the Console and we're getting the Debug. And the Console is using the settings from the logging section of the appsettings.JSON or appsettings.environment.JSON.
If we want to use the logger in code, it's as simple as adding an iLogger<T>, and that's just a Controller D class that you want to get logged. Set that to an iLogger local variable, and then we just need to call any of the logging methods on that logger, and whatever we have configured for the LoggerFactory will then get those log messages.
- Running and debugging ASP.NET Core applications
- Pros and cons of migrating existing applications to ASP.NET Core.
- Built-in dependency injection
- Environment awareness and app configuration
- Web host configuration and SSL
- View components invoked as tag helpers
- Configuration and logging
- Using Razor Pages
Skill Level Intermediate
Set up the sample projects4m 49s
1. Get to Know .NET Core
2. ASP.NET Core 1.0
3. ASP.NET Core 1.1
4. ASP.NET Core 2.0
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.