From e093f7c8b69fda6ff312ba99c3b3f4cfeaeb1a57 Mon Sep 17 00:00:00 2001 From: "Luis A. Garcia" Date: Thu, 12 Sep 2013 20:50:56 +0000 Subject: [PATCH] Consistent logging in the API to better log exceptions With this patch we log the actual message of an exception instead of its str() representation. This allows for consistent error logging in the API. Fixes bug: #1224646 Change-Id: I3965bffb1c2c2eee0af440d1ecd30ccb3bb958d5 --- heat/common/wsgi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/heat/common/wsgi.py b/heat/common/wsgi.py index 08386ed6..04f50793 100644 --- a/heat/common/wsgi.py +++ b/heat/common/wsgi.py @@ -676,6 +676,10 @@ class Resource(object): {'code': err.code, 'explanation': err.explanation}) http_exc = translate_exception(err, request.best_match_language()) raise exception.HTTPExceptionDisguise(http_exc) + except exception.HeatException as err: + logging.error(_("Unexpected error occurred serving API: %s") % + err.message) + raise translate_exception(err, request.best_match_language()) except Exception as err: logging.error(_("Unexpected error occurred serving API: %s") % err) raise translate_exception(err, request.best_match_language()) -- 2.45.2