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
This commit is contained in:
Dean Troyer 2014-10-21 09:51:47 -05:00
parent d07ae4236a
commit 8ba74451ee
2 changed files with 24 additions and 15 deletions

View File

@ -118,7 +118,7 @@ class ClientManager(object):
root_logger = logging.getLogger('') root_logger = logging.getLogger('')
LOG.setLevel(root_logger.getEffectiveLevel()) 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) self.auth = auth_plugin.load_from_options(**self._auth_params)
# needed by SAML authentication # needed by SAML authentication
request_session = requests.session() request_session = requests.session()

View File

@ -137,18 +137,7 @@ class OpenStackShell(app.App):
super(OpenStackShell, self).configure_logging() super(OpenStackShell, self).configure_logging()
root_logger = logging.getLogger('') 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 # Set logging to the requested level
self.dump_stack_trace = False
if self.options.verbose_level == 0: if self.options.verbose_level == 0:
# --quiet # --quiet
root_logger.setLevel(logging.ERROR) root_logger.setLevel(logging.ERROR)
@ -161,11 +150,28 @@ class OpenStackShell(app.App):
elif self.options.verbose_level >= 3: elif self.options.verbose_level >= 3:
# Two or more --verbose # Two or more --verbose
root_logger.setLevel(logging.DEBUG) 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: if self.options.debug:
# --debug forces traceback # --debug forces traceback
self.dump_stack_trace = True 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): def run(self, argv):
try: try:
@ -295,8 +301,11 @@ class OpenStackShell(app.App):
def prepare_to_run_command(self, cmd): def prepare_to_run_command(self, cmd):
"""Set up auth and API versions""" """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: if cmd.auth_required and cmd.best_effort:
try: try:
# Trigger the Identity client to initialize # Trigger the Identity client to initialize