-
Notifications
You must be signed in to change notification settings - Fork 25.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make a doc for the LoggerMessage.DefineScope pattern #2810
Comments
I think some guidance around the implications of mixing something like string interpolation and formatters will be useful to add as well. |
|
@guardrex sounds good. cc @scottaddie |
@Rick-Anderson @scottaddie Proposal for this topic ... Title: High-performance logging with LoggerMessage in ASP.NET Core Outline
|
@BrennanConroy @glennc can you review the outline? LGTM. |
👍 |
TL;DRThis ... .ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole(options => options.IncludeScopes = true);
}) ... is absolutely required to make scopes work? If so, then why is the Rubber duckNeed a head-check on scopes config behavior:
or I assumed that config would take care of it here ... ... but scopes aren't active unless I explicitly set ... .ConfigureLogging((hostingContext, logging) =>
{
logging.AddConsole(options => options.IncludeScopes = true);
}) RE: ... I wondered if that should be ... var value = _configuration["Logging:IncludeScopes"]; ... but even moving "IncludeScopes" up one level doesn't work ... {
"IncludeScopes": true,
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
} No 🎲 🎲 with this either ... {
"Logging": {
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
},
"Console": {
"IncludeScopes": true
}
}
} |
I believe |
@BrennanConroy Thanks. I'll make a small modification to the Logging topic to compensate for the time being. The current language doesn't call it out clearly. @scottaddie @Rick-Anderson I'll add the update for the Logging topic to the |
We should document the low allocation logging pattern that uses
LoggerMessage.DefineScope
andLoggerMessage.Define
as seen here https://github.com/aspnet/KestrelHttpServer/blob/b41c4078bdbbf2b2413fe13922a64552ed1177b6/src/Microsoft.AspNetCore.Server.Kestrel/Internal/Infrastructure/KestrelTrace.cs and https://github.com/aspnet/Mvc/blob/624909763bf762c4448955d00eef1649737df8d6/src/Microsoft.AspNetCore.Mvc.Razor/Internal/MvcRazorLoggerExtensions.csThe text was updated successfully, but these errors were encountered: