While building a basic python app on AppEngine I found this page: https://developers.google.com/api-client-library/python/guide/logging
Which states you can do the following to set the log level:
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
However it doesn't seem to have any impact on the output which is always INFO for me. I set to logging.DEBUG and don't see any debug entries. I set to logging.WARNING and still see info entries. Never seems to change.
I also tried setting httplib2 to debuglevel 4:
import httplib2
httplib2.debuglevel = 4
Yet I don't see any HTTP headers in the log :/
Running python 2.7.10 in PyCharm.
Has anyone got these settings to work?
I have faced a similar issue in python 3, fixed it by configuring a handler for the python logger:
logger.addHandler(logging.StreamHandler(sys.stdout))
I found this solution by wondering what handlers were initially present, and finding there were none:
print(logger.handlers) # []
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With