Logging setLevel is being ignored

Replace the line

logger.setLevel(logging.DEBUG)

with

logging.basicConfig(level=logging.DEBUG, format="%(message)s")

and it should work as expected. If you don’t configure logging with any handlers (as in your post – you only configure a level for your logger, but no handlers anywhere), you’ll get an internal handler “of last resort” which is set to output just the message (with no other formatting) at the WARNING level.

Leave a Comment