Skip to content
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

MicrosoftExtensionsLogging: Add each log argument/attribute to the context data #2519

Open
tylerohlsen opened this issue May 31, 2024 · 3 comments
Labels
community To tag external issues and PRs

Comments

@tylerohlsen
Copy link

tylerohlsen commented May 31, 2024

Feature Description

Currently, with MEL, only log scopes are included in the context data (using logger.BeginScope(...)). The log attributes that are passed as arguments to the standard logger.Log* methods are not in the context data. They are included in the formatted message, but then they lose a lot of value because they need to be parsed back out during ingestion.

For example, explicit calls to the logger (or logger extension methods) like this do not have MyData as a context data value:

logger.LogInformation("My log message with some data: {MyData}", myData);

or via the Source Generator (generated) calls like this do not have the RouteData, MethodInfo, etc as context data values:

[LoggerMessage(102, LogLevel.Information, "Route matched with {RouteData}. Executing controller action with signature {MethodInfo} on controller {Controller} ({AssemblyName}).", EventName = "ControllerActionExecuting", SkipEnabledCheck = true)]
private static partial void ControllerActionExecuting(ILogger logger, string routeData, MethodInfo methodInfo, string controller, string? assemblyName);

Describe Alternatives

None considered

Additional context

I believe this already works as described with other loggers (e.g. Serilog and NLog), but I could be wrong.

Priority

Really Want

@workato-integration
Copy link

@github-actions github-actions bot added the community To tag external issues and PRs label May 31, 2024
@nrcventura
Copy link
Member

@tylerohlsen thank you for submitting this feature request. I passed the information along to other members of the team so that it can be further reviewed.

@dolivanu
Copy link

dolivanu commented Jun 4, 2024

Very useful to get the message attributes parsed by New Relic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community To tag external issues and PRs
Projects
None yet
Development

No branches or pull requests

3 participants