I'm using
logging.basicConfig(format=log_format, level=logging.DEBUG)
in my main script. I like seeing DEBUG messages in most cases. But I want to hide all DEBUG messages from a certain script - lets say connectionpool.py. How can i set connectionpool.py's Log level to INFO while having the rest at DEBUG?
By default, you don't set them by file, but by logging handler name.
Assuming it's
urllib3.connectionpoolthat's bothering you (it's generally pretty noisy onDEBUG),If it really is disabling a file you're after, you could also set up a custom logging filter on your logger to swallow those log records altogether before they're output.
Assuming you haven't set up a more complex hierarchy to split logging output,
would disallow all messages emitted from a module with
connectionpool.pyin the name.