From 5caf1c739e190338e87be8bcd880cb88b0920299 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Tue, 16 Aug 2016 10:17:16 -0400 Subject: [PATCH] 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 --- glance/registry/client/v1/client.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/glance/registry/client/v1/client.py b/glance/registry/client/v1/client.py index 43630ceec2..45c2fb2b35 100644 --- a/glance/registry/client/v1/client.py +++ b/glance/registry/client/v1/client.py @@ -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__