What is a good way to set the logging level for a module in pycharm so that debugging statements will print during a debug session? I am using the native python logging module in python 2.7.
Python logging level can be set inside the Python module, not outside from PyCharm. Your Python application must adjust its own logging level.
Call logging.getLogger() to get the root logger (topmost in logging hierarchy)
Set environment variable in your run configuration in PyCharm. Detect this using os.environ.get("MYDEBUgVARNAME") and then call root.setLevel(logging.DEBUG). I am not sure if PyCharm itself sets any variable based on if it's normal or debug run.
For more information check my blog post for standard Python logging patters https://opensourcehacker.com/2016/05/22/python-standard-logging-pattern/
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