From 9bcd31efc5abcfb529b30c8e067cd421e87d7ed4 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 28 May 2008 13:59:19 -0400 Subject: Fix issue of double logging in ipa_error.log. We open the log in ipa_webgui and this was being inherited by TurboGears which uses the same log so everything was getting logged twice. Shut down the log in ipa_webgui at the last possible moment. This will not catch configuration errors. Add a Not Found template. Only print a traceback on 500 errors. --- ipa-server/ipa-gui/ipagui/controllers.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ipa-server/ipa-gui/ipagui/controllers.py') diff --git a/ipa-server/ipa-gui/ipagui/controllers.py b/ipa-server/ipa-gui/ipagui/controllers.py index 1ec56b25..024a804d 100644 --- a/ipa-server/ipa-gui/ipagui/controllers.py +++ b/ipa-server/ipa-gui/ipagui/controllers.py @@ -84,11 +84,14 @@ class Root(controllers.RootController): """This method is derived from the sample error catcher on http://docs.turbogears.org/1.0/ErrorReporting.""" try: - cherrypy._cputil._cp_on_http_error(status, message) error_msg = self._error_codes.get(status, self._error_codes[None]) url = "%s %s" % (cherrypy.request.method, cherrypy.request.path) - log.exception("CherryPy %s error (%s) for request '%s'", status, - error_msg, url) + if (status == 500): + log.exception("%s error (%s) for request '%s'", status, + error_msg, url) + else: + log.error("%s error (%s) for request '%s'", status, + error_msg, url) if config.get('server.environment') == 'production': details = '' @@ -106,9 +109,14 @@ class Root(controllers.RootController): details = details, ) + if status == 404: + page_template = 'ipagui.templates.not_found' + else: + page_template = 'ipagui.templates.unhandled_exception' + body = controllers._process_output( data, - 'ipagui.templates.unhandled_exception', + page_template, 'html', 'text/html', None -- cgit