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

[logging] Avoid initializing logging multiple times #1850

Closed
wants to merge 1 commit into from

Conversation

olivielpeau
Copy link
Member

The initialization of logging is usually done at the beginning of a python module. This can lead the init of logging to happen multiple times when a module that has already initialized it imports another module that also inits it, which causes the logs of the first module to be duplicated in the second module's logs.

For instance agent.py imports jmxfetch.py, which causes the collector's logs to also end up in jmxfetch.py's logs.

I don't think we ever want the init of logging to happen multiple times per process, hence this commit.

Open for discussion as I'm not sure I'm aware of all the possible consequences of this change.

The initialization of logging is usually done at the beginning
of a python module. This can lead the init of logging to happen
multiple times when a module that has already initialized it
imports another module that also inits it, which causes the
logs of the first module to be duplicated in the second module's
logs.

For instance agent.py imports jmxfetch.py, which causes the collector's
logs to also end up in jmxfetch.py's logs.

I don't think we ever want the init of logging to happen multiple times
per process, hence this commit.
@olivielpeau
Copy link
Member Author

Superseded by #1852. Closing.

@yannmh yannmh deleted the olivielpeau/fix-logging-initialization branch August 21, 2015 18:27
@yannmh yannmh restored the olivielpeau/fix-logging-initialization branch August 21, 2015 18:27
@yannmh yannmh deleted the olivielpeau/fix-logging-initialization branch August 21, 2015 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants