title: How to set the logging level for logger objects?
body: <p>I am having trouble finding the bug in my code when I try to log using the logging library. Even though I set the minimum log-level to DEBUG, the logger creates a log-file that starts at WARNING.</p>
  
  <pre class="lang-py prettyprint-override"><code>import logging
  
  my_logger = logging.getLogger("our logger")  
  
  # Remove all handlers associated with my_logger object. 
  # This is only done so that we can run this block mult. times.
  for handler in my_logger.handlers[:]:
      my_logger.removeHandler(handler)
  
  # let's create a handler and set the logging level
  my_handler_for_file = logging.FileHandler("custom logging.log", mode='w')
  my_handler_for_file.setLevel(logging.DEBUG)   
  # try to set it to logging.CRITICAL and it will only log CRITICAL, 
  # so it does work but neither for DEBUG nor INFO!
  
  # add the handlers to our custom logger
  my_logger.addHandler(my_handler_for_file)
  
  # let's create some logs
  my_logger.debug('This is a debug message')
  my_logger.info('This is an info message')
  my_logger.warning('This is a warning message')
  my_logger.error('This is an error message')
  my_logger.critical('This is a critical message')
  </code></pre>
  
  <p><strong>This is the output in the log-file:</strong></p>
  
  <pre><code>This is a warning message  
  This is an error message  
  This is a critical message
  </code></pre>
  
  <p><strong>And this is what I expect it to be:</strong></p>
  
  <pre><code>This is a debug message  
  This is an info message  
  This is a warning message  
  This is an error message  
  This is a critical message
  </code></pre>
  
  <p>Does anyone have an idea what is wrong here?</p>