How to ignore log entries from imported modules (not written by me)?
The setup:
import logging import <someOtherModule> logging.basicConfig(level=logging.INFO) class myClass: ... def some_method(self): logging.info('calling module') someOtherModule.function() logging.info('stuff happened') if __name__ == "__main__": a = myClass().some_method() The Log:
INFO:root:calling module INFO:<someOtherModule>.<some dependency> <random dependency message here> INFO:root:stuff happened How can I get rid of that middle message?
I was not able to find an answer after looking at the logging documentation or by googling.
I found this answer but the workaround does not seem to work for me.
For the curious ones the actual log entry is:
INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): <address here>