I have an issue with Python logging and I'm not sure what the problem is as the same line of code used to work just fine yesterday.
So for example the following code only produces output for the print function but not for logging.
Any ideas?
import logging
if __name__ == '__main__':
logging.basicConfig(level = logging.DEBUG)
logging.info("Hello, World!")
print "Hello, World!"
You can try this alternative:
>>> import logging
>>> logging.getLogger().setLevel(logging.INFO)
>>> logging.info("Hello, World!")
INFO:root:Hello, World!
Here you are setting to the root logger the info level.
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