From 8181191aeed47706543d65a4c5903aadc3799255 Mon Sep 17 00:00:00 2001 From: Arvind Date: Fri, 8 Feb 2013 11:28:37 +0530 Subject: [PATCH] Adding feature - Flask app will log the errors on to a log file now. Don't have to depend on apache to do it and spend hours on debugging in production. --- fetch.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fetch.py b/fetch.py index afec4c4..13b935e 100644 --- a/fetch.py +++ b/fetch.py @@ -2,6 +2,7 @@ from flask import Flask from flask import request from flask import render_template from flask import make_response +from logging import FileHandler import json import pymongo import os @@ -61,6 +62,11 @@ def listJSON(): ls = map(sanitize, ls) return render_template('history.html', ls=ls) +#Log the errors, don't depend on apache to log it for you. +fil = FileHandler(os.path.join(os.path.dirname(__file__),'logme'),mode='a') +fil.setLevel(logging.ERROR) +app.logger.addHandler(fil) + if __name__ == "__main__": app.run(debug=True, host='0.0.0.0') -- 1.7.10.4