Redirect application log to stderr, which is picked up by gunicorn. (#335)

This commit is contained in:
Kim Pham 2016-04-20 15:09:15 -07:00 committed by Maxime Beauchemin
parent 17e711fda2
commit efc6bf4eb8
1 changed files with 5 additions and 0 deletions

View File

@ -26,6 +26,11 @@ logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_object(CONFIG_MODULE)
if not app.debug:
# In production mode, add log handler to sys.stderr.
app.logger.addHandler(logging.StreamHandler())
app.logger.setLevel(logging.INFO)
db = SQLA(app)
cache = Cache(app, config=app.config.get('CACHE_CONFIG'))