Skip to content

Commit c5d36ce

Browse files
committed
log errors to stderr for uwsgi logs to pick up
ref #11
1 parent 102a56f commit c5d36ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sopy/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import logging
2+
3+
import sys
14
from flask import Flask
25
from flask import render_template
36
from flask_alembic import Alembic
@@ -65,4 +68,9 @@ def not_found(e):
6568
def internal_server_error(e):
6669
return render_template('errors/500.html'), 500
6770

71+
if not app.debug:
72+
handler = logging.StreamHandler(sys.stderr)
73+
handler.setLevel(logging.ERROR)
74+
app.logger.addHander(handler)
75+
6876
return app

0 commit comments

Comments
 (0)