Skip to content

Instantly share code, notes, and snippets.

@sysradium
Created February 25, 2016 22:12
Show Gist options
  • Save sysradium/83118249d7930ef7dfbf to your computer and use it in GitHub Desktop.
Save sysradium/83118249d7930ef7dfbf to your computer and use it in GitHub Desktop.
Logging Flask errors to console to use it with docker and gunicorn
import logging
import flask
app = flask.Flask(__name__)
@app.before_first_request
def setup_logging():
if not app.debug:
# In production mode, add log handler to sys.stderr.
app.logger.addHandler(logging.StreamHandler())
app.logger.setLevel(logging.INFO)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment