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

Fix(Logger): CNX-8443 speckle connectors overwrite static logger instance #3142

Merged

Conversation

oguzhankoral
Copy link
Member

@oguzhankoral oguzhankoral commented Jan 16, 2024

Previously we set out logger instance onto static Log.Logger and properties onto static GlobalLogContext. Now we set global properties on LoggerConfiguration instance before creating instance from ILogger.

Update: We only set id property after creating ILogger. It was causing infinite loop on the case of having no account.

Copy link
Contributor

@AlanRynne AlanRynne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging as requesting changes... but it's more to prevent accidental merging while we discuss these points.

@AlanRynne
Copy link
Contributor

@oguzhankoral it seems you've introduce an infinite loop in your GetUserIdFromDefaultAccount changes, methods that are used to initialise the logger cannot call the logger themselves, or the logger will call Initialise automatically.

Screenshot 2024-01-16 at 14 01 52

Copy link
Member

@JR-Morgan JR-Morgan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From several places in our code, We're pushing scoped logs via the LogContext.PushProperty (see Operations.Receive) for an example.

Discussed briefly with Alan and Oguzhan, we should find an alternative for these to use SpeckleLog explicitly

@JR-Morgan JR-Morgan added this to the 2.18 milestone Jan 18, 2024
…ctors-Overwrite-Static-Logger-Instance

# Conflicts:
#	Core/Tests/Speckle.Core.Tests.Unit/Speckle.Core.Tests.Unit.csproj
@oguzhankoral
Copy link
Member Author

Pulled from dev again and @JR-Morgan's tests are passed with this PR. @AlanRynne if you don't have an objection it should be good to go.

@AlanRynne AlanRynne merged commit a07fe34 into dev Jan 18, 2024
32 checks passed
@AlanRynne AlanRynne deleted the CNX-8443-Speckle-Connectors-Overwrite-Static-Logger-Instance branch January 18, 2024 15:52
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.

3 participants