[sdk-logs] Update LogRecord to keep CategoryName and Logger in sync#5317
Merged
alanwest merged 9 commits intoopen-telemetry:mainfrom Feb 7, 2024
Merged
Conversation
…github.com/CodeBlanch/opentelemetry-dotnet into sdk-logs-categoryname-instrumentationscope
| if (otlpLogRecord != null) | ||
| { | ||
| var scopeName = logRecord.CategoryName ?? logRecord.Logger?.Name ?? DefaultScopeName; | ||
| var scopeName = logRecord.Logger.Name; |
Member
There was a problem hiding this comment.
In the tests, we are proving that the values of logRecord.Logger.Name and logRecord.CategoryName are the same. Is there any difference in using one over the other in this context?
Member
There was a problem hiding this comment.
OTLPExporter can remain agnostic to ILogger specific CategoryName.
Member
Author
There was a problem hiding this comment.
No practical difference between the two. This is more of a philosophical change which brings OtlpExporter closer to the spec. The goal being it doesn't know anything about any specific logging framework (ILogger being one of those).
rajkumar-rangaraj
approved these changes
Feb 6, 2024
alanwest
approved these changes
Feb 7, 2024
This was referenced Oct 11, 2025
Closed
This was referenced Nov 26, 2025
Closed
Closed
This was referenced Dec 4, 2025
This was referenced Feb 18, 2026
This was referenced Feb 26, 2026
Open
This was referenced Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #5300 (comment)
Changes
LogRecord.Loggerto aLoggerbuilt fromCategoryName.LogRecord.CategoryNamegetter to returnLogRecord.Logger.Name.LogRecord.CategoryNamesetter to changeLogRecord.Logger(if needed).LogRecord.Logger.Name.Details
The big benefit to this change is if users start using something which is emitting logs via the Log Bridge API AND they use an exporter coded to expect
CategoryNamethey will now have something set.One thing @alanwest will like is OtlpLogExporter no longer has any knowledge of
CategoryName. You're welcome @alanwest! 😄Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes