title: How to add stdout and stderr to logger file in flask
body: <p>I want to log the stdout &amp; stderr to log files, and this is what I tried.</p>
  
  <pre><code>app = Flask(__name__)
  app.logger.setLevel(logging.INFO)  # use the native logger of flask
  app.logger.disabled = False
  handler = logging.handlers.RotatingFileHandler(
      SYSTEM_LOG_FILENAME,
      'a',
      maxBytes=1024 * 1024 * 100,
      backupCount=20
      )
  
  formatter = logging.Formatter(\
      "%(asctime)s - %(levelname)s - %(name)s: \t%(message)s")
  handler.setFormatter(formatter)
  app.logger.addHandler(handler)
  
  @app.route('/')
  def hello():
  
      return 'Hello World'
  if __name__ == '__main__':
      app.run()        
  </code></pre>
  
  <p>Then I would like to log the console output in files.
  such as  </p>
  
  <pre><code>* Running on http://127.0.0.1:5000/
  127.0.0.1 - - [24/May/2013 14:55:14] "GET / HTTP/1.1" 200 -
  127.0.0.1 - - [24/May/2013 14:55:14] "GET /favicon.ico HTTP/1.1" 404 -
  </code></pre>
  
  <p>what can I do? </p>