Stop stack tracing on 404s

Glance has had this persistent bit of log noise where trying to GET a
non existent image creates a stack trace at ERROR log level. This
makes glance api logs extra noisy, and confuses when actual errors
happen.

Change-Id: Ic08f3a3885f31433f2416e317b412e743512f797
This commit is contained in:
Sean Dague
2016-08-16 10:17:16 -04:00
parent 7df813bba4
commit 5caf1c739e
+8
View File
@@ -25,6 +25,7 @@ import six
from glance.common.client import BaseClient
from glance.common import crypt
from glance.common import exception
from glance.i18n import _LE
from glance.registry.api.v1 import images
@@ -130,6 +131,13 @@ class RegistryClient(BaseClient):
{'method': method, 'action': action,
'status': status, 'request_id': request_id})
# a 404 condition is not fatal, we shouldn't log at a fatal
# level for it.
except exception.NotFound:
raise
# The following exception logging should only really be used
# in extreme and unexpected cases.
except Exception as exc:
with excutils.save_and_reraise_exception():
exc_name = exc.__class__.__name__