From fab893f333fa80567ef12f6817d52459b28c84a4 Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Tue, 28 Feb 2012 07:34:08 +0000 Subject: [PATCH] TypeError API exceptions get logged incorrectly Fixes bug 942431 LOG.exception() always logs sys.exc_info() which does not always represent the real exception we want to log. This changes the wsgi ResourceExceptionHandler context manager to LOG.error() the traeback info that's passed to __exit__() Change-Id: I0c3728a9ee740597feb828a513aea76e7849efc6 --- nova/api/openstack/wsgi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/api/openstack/wsgi.py b/nova/api/openstack/wsgi.py index ad45284c7d..8f0259024c 100644 --- a/nova/api/openstack/wsgi.py +++ b/nova/api/openstack/wsgi.py @@ -21,7 +21,6 @@ from xml.parsers import expat from lxml import etree import webob -from webob import exc from nova import exception from nova import log as logging @@ -574,7 +573,9 @@ class ResourceExceptionHandler(object): msg = unicode(ex_value) raise Fault(webob.exc.HTTPForbidden(explanation=msg)) elif isinstance(ex_value, TypeError): - LOG.exception(ex_value) + exc_info = (ex_type, ex_value, ex_traceback) + LOG.error(_('Exception handling resource: %s') % ex_value, + exc_info=exc_info) raise Fault(webob.exc.HTTPBadRequest()) elif isinstance(ex_value, Fault): LOG.info(_("Fault thrown: %s"), unicode(ex_value))