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 logging redudancy on multiple instances #73

Merged
merged 2 commits into from
Jul 23, 2024

Conversation

Snailed
Copy link
Collaborator

@Snailed Snailed commented Jun 26, 2024

When making multiple trackers (or re-instantiating as common in Notebook-like environments), each instantiation of CarbonTracker causes logging to duplicate messages. This is due to logger.getLogging always returning the same logging instance when called with the same argument (singleton-like). This is fixed by having each instance of CarbonTracker have a unique logging_id, which makes each instance have their own logger.

This solves issue #70

@Snailed Snailed requested a review from PedramBakh June 26, 2024 11:10
When making multiple trackers (or re-instantiating as common in
Notebook-like environments), each instantiation of CarbonTracker causes
logging to duplicate messages. This is due to logger.getLogging always
returning the same logging instance when called with the same argument
(singleton-like). This is fixed by having each instance of CarbonTracker
have a unique logging_id, which makes each instance have their own
logger.

also including changes to logger
@Snailed Snailed force-pushed the fix-multiple-instantiations branch from c06b3e1 to 2e1d3eb Compare June 26, 2024 11:12
@Snailed Snailed merged commit 050cc45 into lfwa:dev Jul 23, 2024
6 checks passed
@Snailed Snailed deleted the fix-multiple-instantiations branch July 23, 2024 09:46
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.

1 participant