From 5b59253667a12a1b592d967bbcaa1f1adda559d3 Mon Sep 17 00:00:00 2001 From: Hongbin Lu Date: Wed, 14 Jan 2015 19:47:02 +0000 Subject: [PATCH] Fix an error on not finding log handler Magnum client should not log any warning message if there is no logging handler. Otherwise, magnum client will print a confusing message when server return a failure status. Below is the exact message: No handlers could be found for logger "magnumclient.common.httpclient" This message is just a warning that can be safely ignored. In particular, this message does not indicate the root cause of the problem. Users should find the root cause from other places (e.g. the server logs). Change-Id: If6ba4f1bb4900b5632049e8a8a8bfd3b12035f8d --- magnumclient/common/httpclient.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/magnumclient/common/httpclient.py b/magnumclient/common/httpclient.py index bc206f8d..1b72ad7b 100644 --- a/magnumclient/common/httpclient.py +++ b/magnumclient/common/httpclient.py @@ -172,7 +172,8 @@ class HTTPClient(object): self.log_http_response(resp) if 400 <= resp.status < 600: - LOG.warn("Request returned failure status.") + if LOG.handlers: + LOG.warn("Request returned failure status.") error_json = self._extract_error_json(body_str) raise exceptions.from_response( resp, error_json.get('faultstring'),