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

Loggers don't use latest writer #1586

Closed
manfred-brands opened this issue Jan 2, 2025 · 0 comments
Closed

Loggers don't use latest writer #1586

manfred-brands opened this issue Jan 2, 2025 · 0 comments
Assignees
Labels
Milestone

Comments

@manfred-brands
Copy link
Member

The InternalTrace class uses a static writer which is set in a call to Initialize.
Any caller that gets a ILogger before that call to Initialize is made gets a null writer.

InternalTrace.Initialize is called from TestEngine.Initialize.
Before a user can get there, the initializer of TestEngine has called new ServiceContext() which calls new ServiceManager() which calls InternalTrace.GetLogger(). This logger is called with the InternalTraceLevel.Default meaning it will never log anything.

If the user added any services before that call to TestEngine.Initialize none of them would every log either.

To solve this, the InternalTrace.GetLogger calls should not take the writer and DefaultTraceLevel when called, but the ones that are active.

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

Successfully merging a pull request may close this issue.

2 participants