Skip to content
Snippets Groups Projects
Commit 76ccaf40 authored by Vermaat's avatar Vermaat
Browse files

Log errors to standard output in production mode

parent 2fc16d8c
No related branches found
No related tags found
No related merge requests found
......@@ -19,14 +19,22 @@ You can also use the built-in HTTP server by running this file directly.
import argparse
import logging
import sys
from wsgiref.simple_server import make_server
from spyne.server.wsgi import WsgiApplication
from ..config import settings
from ..services import json
# Setup logging.
log_level = logging.INFO if settings.DEBUG else logging.ERROR
logging.basicConfig(level=log_level)
logging.getLogger('spyne.protocol.xml').setLevel(log_level)
#: WSGI application instance.
application = WsgiApplication(json.application)
......
......@@ -19,14 +19,22 @@ You can also use the built-in HTTP server by running this file directly.
import argparse
import logging
import sys
from wsgiref.simple_server import make_server
from spyne.server.wsgi import WsgiApplication
from ..config import settings
from ..services import soap
# Setup logging.
log_level = logging.INFO if settings.DEBUG else logging.ERROR
logging.basicConfig(level=log_level)
logging.getLogger('spyne.protocol.xml').setLevel(log_level)
#: WSGI application instance.
application = WsgiApplication(soap.application)
......
......@@ -3,6 +3,7 @@ Mutalyzer website interface using the Flask framework.
"""
import logging
import os
import pkg_resources
......@@ -67,6 +68,13 @@ def create_app():
from mutalyzer.website.views import website
app.register_blueprint(website)
@app.before_first_request
def setup_logging():
if not settings.DEBUG:
# In production mode, log errors to standard error.
app.logger.addHandler(logging.StreamHandler())
app.logger.setLevel(logging.ERROR)
@app.teardown_appcontext
def shutdown_session(exception=None):
session.remove()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment