Games & Quizzes
Don't forget to Sign In to save your points
This is a modal window.
PERFECT HITS | +NaN | |
HITS | +NaN | |
LONGEST STREAK | +NaN | |
TOTAL | + |
Hi, this is Mike Rousos from the .NET Customer Success Team. I'm going to talk today briefly about logging in ASP.NET Core.
So, if you have an ASP.NET Core app and you want to log some diagnostics,
you're typically going to be using the Microsoft.Extensions.Logging package. Let me hop over to NuGet and show that to you.
Microsoft.Extensions.Logging is what you're looking for.
You won't have to install this, typically, because it's already included in the package references for all of our ASP.NET Core
templates, but this is the package that you use and, like all, Microsoft.Extensions packages,
there's nothing in here specific to ASP.NET Core. This just
depends on .NET Standard 1.1, so you could just as easily
use this logging framework in a .NET Core console app, .NET Framework app, UWP, just the same as you would in
ASP.NET Core.. But, coming back to how it works in ASP.NET Core,. when you look at your ASP.NET Core app, you'll notice that in the templates our configure method in Startup.cs
will take an ILoggerFactory. This logger factory is what produces logger objects which we use to log events.
In the configure method, though, we need to set it up with all of the providers we want to use
for writing those logged messages to different endpoints. Now, one of the great things about the Microsoft.Extensions.Logging framework
used in ASP.NET Core is its flexibility and its extensibility.
By default, you'll have an .AddDebug which adds a debug provider so that we write to debug output.
And you typically also have an .AddConsole. as well in your. template that you start with and this will just write debug
/ˈtemplət/
shaped piece of rigid material used as pattern for processes. Something used as a model to produce many copies.
/ˈref(ə)rəns/
action of mentioning or alluding to something. A letter of recommendation, e.g. for a job. To cite a piece of research in speech or writing.
/ˈmesij/
verbal written or recorded communication. Ideas or themes in a story, book, or film. To communicate using text.
/ˈpakij/
Presented as one item but includes several. Box or container items are placed in for mailing. put into box or wrapping.
/ˈlo͝okiNG/
having specified appearance. To appear to be when you look at them; seem.
material thing. Goals or purposes of particular plans or activities. To disagree; to protest against an idea or plan.
/ˌdīəɡˈnästik/
concerned with diagnosis of illness etc.. distinctive symptom or characteristic.
/prəˈvīdər/
person or thing that provides something. Companies or group that offer a particular service.