Skip to content

Property in LogEvent should not be overridden by scope #272

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

huoshan12345
Copy link

@huoshan12345 huoshan12345 commented Apr 1, 2025

fixes #271

NOTE:
ExternalScopeProvider.ForEachScope processes scopes from outer to inner, which is the opposite of Serilog's scope traversal order. This fix implements ForEachScopeReversed and passes update: false to the method EnrichWithStateAndCreateScopeItem to ensure consistent behavior matching Serilog's expectations.

@nblumhardt
Copy link
Member

Thanks for sending this. Because the method is called for every log statement, I'm not sure the added cost of creating, populating, and iterating through an additional List will be acceptable. We might need to investigate alternative approaches to #289 instead 🤔

@huoshan12345
Copy link
Author

Thanks for sending this. Because the method is called for every log statement, I'm not sure the added cost of creating, populating, and iterating through an additional List will be acceptable. We might need to investigate alternative approaches to #289 instead 🤔

Thanks for reviewing the PR!
I'm glad you brought this up - I've been exploring solutions but haven't found a better approach yet.
By the way, I noticed you referenced #289, but I don't seem to have access to that issue. Is it a private issue perhaps?

@nblumhardt
Copy link
Member

Sorry! The PR I meant to refer to is #269.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Behavior Change: Property Value Overriding in LogEvents Since Serilog.Extensions.Logging 9.0.1
2 participants