Improve --debug logging output

This change makes the following improvements to the output of a
ceilometer command with the --debug option set:

* Silences spurious logging from iso8601 and urllib3.connectionpool
* Removes the line number from the logging format, since the intent
  of --debug is to show the user what network requests are occuring.

Change-Id: I1b286adf63b1ca05ec4fcfb27fbc939aa662cc7e
Closes-bug: #1324470
This commit is contained in:
liu-sheng 2014-06-24 09:20:49 +08:00
parent e5cd3b26b7
commit 617f7f87cb
1 changed files with 3 additions and 1 deletions

View File

@ -221,11 +221,13 @@ class CeilometerShell(object):
subparser.set_defaults(func=callback)
def _setup_logging(self, debug):
format = '%(levelname)s (%(module)s:%(lineno)d) %(message)s'
format = '%(levelname)s (%(module)s) %(message)s'
if debug:
logging.basicConfig(format=format, level=logging.DEBUG)
else:
logging.basicConfig(format=format, level=logging.WARN)
logging.getLogger('iso8601').setLevel(logging.WARNING)
logging.getLogger('urllib3.connectionpool').setLevel(logging.WARNING)
def parse_args(self, argv):
# Parse args once to find version