title: Python Logging - Disable logging from imported modules
body: <p>I'm using the Python logging module, and would like to disable log messages printed by the third party modules that I import.  For example, I'm using something like the following:</p>
  
  <pre><code>logger = logging.getLogger()
  logger.setLevel(level=logging.DEBUG)
  fh = logging.StreamHandler()
  fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(lineno)d:%(filename)s(%(process)d) - %(message)s')
  fh.setFormatter(fh_formatter)
  logger.addHandler(fh)
  </code></pre>
  
  <p>This prints out my debug messages when I do a logger.debug("my message!"), but it also prints out the debug messages from any module I import (such as requests, and a number of other things).</p>
  
  <p>I'd like to see only the log messages from modules I'm interested in.  Is it possible to make the logging module do this?</p>
  
  <p>Ideally, I'd like to be able tell the logger to print messages from "ModuleX, ModuleY" and ignore all others.</p>
  
  <p>I looked at the following, but I don't want to have to disable/enable logging before every call to an imported function:
  <a href="https://stackoverflow.com/questions/27685568/logging-how-to-ignore-imported-module-logs">logging - how to ignore imported module logs?</a></p>