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

Clear logging handler when initializing the logger #529

Merged
merged 1 commit into from
Jun 18, 2024

Conversation

mtneug
Copy link
Member

@mtneug mtneug commented May 17, 2024

This patch clears the root logging handlers when initializing the logger.

This might be considered a quickfix. The root problem is that the configuration might be loaded twice when starting up:

  1. When importing the Prometheus collectors, the configuration is loaded implicitly when accessing configuration values.
  2. __main__.py calls config.update_configuration explicitly.

The result is that the list of root logging handlers contains duplicate entries. Each line is thus logged twice.

Since the config can be loaded lazily, one might remove the explicit call in __main__.py. However, my reasoning for this approach was that resetting the logger handlers during initialization makes sense anyway.

@lkiesow
Copy link
Member

lkiesow commented Jun 18, 2024

Rebased on current main

@lkiesow lkiesow merged commit 8454b91 into opencast:main Jun 18, 2024
8 checks passed
@mtneug mtneug deleted the quickfix-logger branch June 20, 2024 06:22
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.

2 participants