Importing google.cloud.logging.Client adds StreamHandler to root #6477
Labels
api: logging
Issues related to the Cloud Logging API.
type: question
Request for information or clarification. Not an issue.
Importing a google cloud logging Client adds a handler to the root logger. That's IMO unexpected and may break users code. Imports must not have any side-effects.
A real-life example when it broke our code: our library has something like:
but because we imported the Client somewhere on the beginning of the module, this didn't get executed.
Environment details
Python 3.7.0
, docker imagepython:3.7-slim
Steps to reproduce
docker run -ti python:3.7-slim bash
pip install google-cloud-logging=1.8.0
python
:The text was updated successfully, but these errors were encountered: