Created
February 25, 2016 22:12
-
-
Save sysradium/83118249d7930ef7dfbf to your computer and use it in GitHub Desktop.
Logging Flask errors to console to use it with docker and gunicorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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