CLI always configures logging

When the keystone CLI wound up logging something and --debug
wasn't set, a message was printed that 'No handlers could be
found for logger <whatever>'. This is because Python logging
was only configured when the --debug option was set.

This change makes it so that logging is always configured. If
--debug is used then the level is DEBUG and if it's not used
then the level is WARNING.

Change-Id: Ib01d1072acff0d6ede468b0ecab4f871459014ee
Closes-Bug: #936404
This commit is contained in:
Brant Knudson 2014-04-16 17:07:03 -05:00
parent 474c110f62
commit 59daf4bf02
1 changed files with 5 additions and 1 deletions

View File

@ -383,7 +383,11 @@ class OpenStackIdentityShell(object):
return 0
if args.debug:
logging.basicConfig(level=logging.DEBUG)
logging_level = logging.DEBUG
else:
logging_level = logging.WARNING
logging.basicConfig(level=logging_level)
# TODO(heckj): supporting backwards compatibility with environment
# variables. To be removed after DEVSTACK is updated, ideally in