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

Please don't use basicConfig. #14

Closed
SmartHoneybee opened this issue Nov 1, 2017 · 0 comments
Closed

Please don't use basicConfig. #14

SmartHoneybee opened this issue Nov 1, 2017 · 0 comments

Comments

@SmartHoneybee
Copy link
Contributor

Hello!

What?
Please change:

logging.basicConfig(level=logging.INFO)
log = logging.getLogger('mattermostdriver. ...')

to:

log = logging.getLogger('mattermostdriver. ...')
log.setLevel(logging.INFO)

i.e. do not configure the root logger, but only the current logger.

Why?

logging.basicConfig(**kwargs)
...
This function does nothing if the root logger already has handlers configured for it.

So this will not work as expected:

import logging
import mattermostdriver # calls logging.basicConfig
logging.basicConfig(level=logging.DEBUG) # does nothing
logging.debug("Test") # output suppressed

This would print the desired output but the import order is wrong:

import logging
logging.basicConfig(level=logging.DEBUG)
import mattermostdriver
logging.debug("Test")

Thank you for your work!

Vaelor added a commit that referenced this issue Nov 2, 2017
@Vaelor Vaelor closed this as completed Nov 2, 2017
Vaelor added a commit that referenced this issue Jan 16, 2018
Vaelor added a commit that referenced this issue Feb 22, 2018
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

No branches or pull requests

1 participant