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.info() triggers basicConfig() #332

Closed
kamilglod opened this issue Dec 1, 2020 · 2 comments
Closed

logging.info() triggers basicConfig() #332

kamilglod opened this issue Dec 1, 2020 · 2 comments

Comments

@kamilglod
Copy link

@kamilglod kamilglod commented Dec 1, 2020

When I use download_as_string() method or similar, logging.root logger is being activated by calling logging.info() on line

. It causes other loggers to be logged by the root logger which is unexpected as some apps require a single logger in strict format.

Environment details

  • OS type and version: ubuntu 20.04
  • Python version: 3.8.6
  • pip version: 20.2.4
  • google-cloud-storage version: 1.33.0

Steps to reproduce

  1. set up your own logger for any logger
  2. call logger.info("test") (nothing should happen)
  3. run Client.from_service_account_json().get_bucket(...).blob(..., chunk_size=1024*1024).download_as_string()
  4. call logger.info("test") one more time
  5. log in basic format should appear on stdout (unexpected)

How to fix it

you need to use your own logger (e.g. using logging.getLogger(__name__) instead of root logger.

@tseaver
Copy link
Contributor

@tseaver tseaver commented Dec 1, 2020

Bug injected in PR #246.

@tseaver
Copy link
Contributor

@tseaver tseaver commented Dec 1, 2020

@kamilglod Thanks very much for the report!

@andrewsg andrewsg closed this in #333 Dec 1, 2020
andrewsg pushed a commit that referenced this issue Dec 1, 2020
shaffeeullah added a commit to shaffeeullah/python-storage that referenced this issue Jan 26, 2021
shaffeeullah added a commit to shaffeeullah/python-storage that referenced this issue Jan 26, 2021
cojenco added a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
cojenco added a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants