title: Changing the log level of an imported module
body: <p>Suppose your code is using a module that 
  uses log statements with <code>logging.info</code> from the module as opposed to <code>logger.info</code> from a logger instance, and that you don't have control to modify the module that is in use.</p>
  
  <p>Is it possible to customize the logging levels for JUST the imported module without requesting a code change from the maintainers?</p>
  
  <p>These questions have described a very straightforward approach for changing the logging level for a particular module. 
  <br><a href="https://stackoverflow.com/questions/11029717/how-do-i-disable-log-messages-from-the-requests-library">How do I disable log messages from the Requests library?</a>
  <br><a href="https://stackoverflow.com/questions/35325042/python-logging-disable-logging-from-imported-modules/35325280">Python Logging - Disable logging from imported modules</a></p>
  
  <p>The code below implements that solution as described to log only ERROR messages from that module, but it did not turn of WARNING messages as expected. </p>
  
  <p>The test module produces the same output when referring to the noisy_noise module as a string literal and by using the name of the imported symbol. </p>
  
  <p>What is missing from run_me.py to suppress WARN messages?</p>
  
  <h2>noisy_noise.py</h2>
  
  <p><em>EDIT: Assume this module represents one that is imported from other maintainers and is closed for modification</em></p>
  
  <pre><code>import logging
  
  def log_things():
      logging.warn('WARNING')
      logging.info('INFORMATION')
      logging.error('DANGER')
  </code></pre>
  
  <h2>run_me.py</h2>
  
  <pre><code>import logging
  import noisy_noise
  import sys
  
  def main(args):
      logging.getLogger(noisy_noise.__name__).setLevel(logging.ERROR)
  #    logging.getLogger('noisy_noise').setLevel(logging.ERROR)
  
      noisy_noise.log_things()
  
  if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))
  </code></pre>
  
  <pre><code>$ python run_me.py
  WARNING:root:WARNING
  ERROR:root:DANGER
  </code></pre>