From 8ba74451ee9efe21a0554c184f28e380fe714313 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Tue, 21 Oct 2014 09:51:47 -0500 Subject: [PATCH] Adjust some logging levels * Promote select messages to INFO so lower logging levels can be useful * Help more modules not say so much all the time Change-Id: I814023c1489595998ae74efe40ef439b3522ee74 --- openstackclient/common/clientmanager.py | 2 +- openstackclient/shell.py | 37 +++++++++++++++---------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index adec842f13..0396e83dd2 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -118,7 +118,7 @@ class ClientManager(object): root_logger = logging.getLogger('') LOG.setLevel(root_logger.getEffectiveLevel()) - LOG.debug('Using auth plugin: %s' % self.auth_plugin_name) + LOG.info('Using auth plugin: %s' % self.auth_plugin_name) self.auth = auth_plugin.load_from_options(**self._auth_params) # needed by SAML authentication request_session = requests.session() diff --git a/openstackclient/shell.py b/openstackclient/shell.py index e671ecc3dc..1198bae18a 100644 --- a/openstackclient/shell.py +++ b/openstackclient/shell.py @@ -137,18 +137,7 @@ class OpenStackShell(app.App): super(OpenStackShell, self).configure_logging() root_logger = logging.getLogger('') - # Requests logs some stuff at INFO that we don't want - # unless we have DEBUG - requests_log = logging.getLogger("requests") - requests_log.setLevel(logging.ERROR) - - # Other modules we don't want DEBUG output for so - # don't reset them below - iso8601_log = logging.getLogger("iso8601") - iso8601_log.setLevel(logging.ERROR) - # Set logging to the requested level - self.dump_stack_trace = False if self.options.verbose_level == 0: # --quiet root_logger.setLevel(logging.ERROR) @@ -161,11 +150,28 @@ class OpenStackShell(app.App): elif self.options.verbose_level >= 3: # Two or more --verbose root_logger.setLevel(logging.DEBUG) - requests_log.setLevel(logging.DEBUG) + + # Requests logs some stuff at INFO that we don't want + # unless we have DEBUG + requests_log = logging.getLogger("requests") + + # Other modules we don't want DEBUG output for + cliff_log = logging.getLogger('cliff') + stevedore_log = logging.getLogger('stevedore') + iso8601_log = logging.getLogger("iso8601") if self.options.debug: # --debug forces traceback self.dump_stack_trace = True + requests_log.setLevel(logging.DEBUG) + cliff_log.setLevel(logging.DEBUG) + else: + self.dump_stack_trace = False + requests_log.setLevel(logging.ERROR) + cliff_log.setLevel(logging.ERROR) + + stevedore_log.setLevel(logging.ERROR) + iso8601_log.setLevel(logging.ERROR) def run(self, argv): try: @@ -295,8 +301,11 @@ class OpenStackShell(app.App): def prepare_to_run_command(self, cmd): """Set up auth and API versions""" - self.log.debug('prepare_to_run_command %s', cmd.__class__.__name__) - + self.log.info( + 'command: %s.%s', + cmd.__class__.__module__, + cmd.__class__.__name__, + ) if cmd.auth_required and cmd.best_effort: try: # Trigger the Identity client to initialize