title: logging flask errors with mod_wsgi
body: <p>I've been trying to get this working since a long time but I'm really at my wits end now. I've tried to do everything that I could find on SO and flask documentation and still I cant a simple error log working so that I can debug my applcation. Below is the pasted code -</p>
  
  <pre><code># main.py
  from flask import Flask
  import logging
  
  app = Flask(__name__)
  file_handler = logging.FileHandler(filename='/tmp/election_error.log')
  file_handler.setLevel(logging.WARNING)
  app.logger.addHandler(file_handler)
  
  @app.route('/')
  def hello():
     return "hello
     #missing quotes to generate error
  
  if __name__ == "__main__":
     app.run()
  
  
  #wsgi file
  import sys
  import logging
  sys.path.insert(0, "/var/www/voting_app")
  logging.basicConfig(stream=sys.stderr)
  from main import app as application
  
  
  # apache2 conf file
  WSGIDaemonProcess voting_app threads=5
  WSGIScriptAlias /election /var/www/voting_app/voting_app.wsgi
  
  LogLevel info
  
  &lt;Directory /var/www/voting_app&gt;
          WSGIProcessGroup voting_app
          WSGIApplicationGroup %{GLOBAL}
          Order deny,allow
          Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p>Please tell me where I'm going wrong. Thank you so much.</p>