summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Coles <alistair.coles@hp.com>2014-11-13 12:18:41 +0000
committerAlistair Coles <alistair.coles@hp.com>2014-11-13 13:38:07 +0000
commite566f77a6edca1585179e5048ee41f1edfeb94e1 (patch)
tree7c856f1d8a43187faca122794fd834e02ec63b6b
parent202bbab2d06b9ef751fba306effd09f3bae8f383 (diff)
downloadpython-swiftclient-e566f77a6edca1585179e5048ee41f1edfeb94e1.tar.gz
Suppress 'No handlers...' message from keystoneclient logger
keystoneclient isn't adding a NullHandler to its logger, so we see 'No handlers could be found for logger...' messages when using the swift cli with keystone auth. Since keystoneclient follows the usual pattern of naming loggers from module name, we can add a NullHandler to the 'keystoneclient' logger to handle any logging from the library. Note that this makes no change to keystoneclient logging being emitted when using 'swift --debug' or 'swift --info'. No test because I am not sure how to usefully test this without ending up just testing a mock of keystoneclient. Change-Id: Ic81cf8e5a590ae9224d35e3a5b1c5f2a8c33835a
-rw-r--r--swiftclient/client.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index d917cc2..84b50d2 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -294,6 +294,8 @@ def _import_keystone_client(auth_version):
else:
from keystoneclient.v2_0 import client as ksclient
from keystoneclient import exceptions
+ # prevent keystoneclient warning us that it has no log handlers
+ logging.getLogger('keystoneclient').addHandler(NullHandler())
return ksclient, exceptions
except ImportError:
sys.exit('''