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 · Fixed by #333
Closed

logging.info() triggers basicConfig() #332

kamilglod opened this issue Dec 1, 2020 · 2 comments · Fixed by #333
Assignees
Labels
api: clouddebugger Issues related to the Stackdriver Debugger API. api: storage Issues related to the googleapis/python-storage API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.

Comments

@kamilglod
Copy link

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.

@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/python-storage API. label Dec 1, 2020
@tseaver tseaver self-assigned this Dec 1, 2020
@tseaver tseaver added api: clouddebugger Issues related to the Stackdriver Debugger API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels Dec 1, 2020
@tseaver
Copy link
Contributor

tseaver commented Dec 1, 2020

Bug injected in PR #246.

@tseaver
Copy link
Contributor

tseaver commented Dec 1, 2020

@kamilglod Thanks very much for the report!

andrewsg pushed a commit that referenced this issue Dec 1, 2020
cojenco pushed a commit to cojenco/python-storage that referenced this issue Oct 13, 2021
cojenco pushed 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
Labels
api: clouddebugger Issues related to the Stackdriver Debugger API. api: storage Issues related to the googleapis/python-storage API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release.
Projects
None yet
2 participants