title: Python logging to write all level logs to file
body: <pre><code>import logging
  
  def set_logging():
      logging.basicConfig(
          format='%(asctime)s %(levelname)s %(message)s',
          level=logging.INFO,
          datefmt='%m/%d/%Y %I:%M:%S %p'
          )
      logger = logging.getLogger('simple_example')
      fl = logging.FileHandler("myapp.log")
      fl.setLevel(logging.INFO)
      logger.addHandler(fl)
      return logger
  
  if __name__ == "__main__":
      logger = set_logging()
      logger.info('infoooo')
      logger.error('erorrrr')
  
  Output:
  /home/admin# python logging.py
  09/08/2019 02:40:36 PM INFO infoooo
  09/08/2019 02:40:36 PM ERROR erorrrr
  /home/admin# cat myapp.log
  infoooo
  erorrrr
  </code></pre>
  
  <p>If i comment out logging.basicConfig() line in above code, output is not seen in console and only 'erorrrr' message is written to file. What can i change in the above code to write all level logs to file without writing anything to console?</p>