From 42eab0c82f0ef17cd1e7dd54da2964b8eb19c660 Mon Sep 17 00:00:00 2001 From: Radoslav Gerganov Date: Mon, 6 Oct 2014 15:40:27 +0300 Subject: [PATCH] Supress error logs when exception is thrown There are many cases when exceptions from the backend are expected and these exceptions must not be logged as errors. For example it is a common pattern to catch DuplicateName/AlreadyExists exceptions and ignore them in the cases when multiple threads are trying to perform the same operation. Currently there is no way for clients to prevent logging these exceptions as errors and the proper way to fix this is to just raise the exception in oslo and let the client decide if it must be logged as an error or not. Closes-Bug: #1377927 Change-Id: I5309cad5b0eeb380387eb3051d80c59b783561e8 --- oslo/vmware/api.py | 6 ------ oslo/vmware/common/loopingcall.py | 1 - 2 files changed, 7 deletions(-) diff --git a/oslo/vmware/api.py b/oslo/vmware/api.py index 930a6d4..7920ba5 100644 --- a/oslo/vmware/api.py +++ b/oslo/vmware/api.py @@ -112,12 +112,6 @@ class RetryDecorator(object): self._retry_count += 1 self._sleep_time += self._inc_sleep_time return self._sleep_time - except Exception: - with excutils.save_and_reraise_exception(): - LOG.exception(_LE("Exception which is not in the " - "suggested list of exceptions occurred " - "while invoking %s."), - func_name) raise loopingcall.LoopingCallDone(result) def func(*args, **kwargs): diff --git a/oslo/vmware/common/loopingcall.py b/oslo/vmware/common/loopingcall.py index bb8c256..e82b5cb 100644 --- a/oslo/vmware/common/loopingcall.py +++ b/oslo/vmware/common/loopingcall.py @@ -133,7 +133,6 @@ class DynamicLoopingCall(LoopingCallBase): self.stop() done.send(e.retvalue) except Exception: - LOG.exception(_LE('in dynamic looping call')) done.send_exception(*sys.exc_info()) return else: