Set up debug level on root logger.
If we set up the debug level on the root logger, this can be used by the submodules that might need to print some debug output. Change-Id: I2a00b40d4748cc62e6081df7d6a44622f5ad4467
This commit is contained in:
parent
c5b579926f
commit
e9e05d7dfe
@ -97,11 +97,17 @@ class HTTPClient(object):
|
||||
|
||||
self._logger = logging.getLogger(__name__)
|
||||
if self.http_log_debug:
|
||||
# Logging level is already set on the root logger
|
||||
ch = logging.StreamHandler()
|
||||
self._logger.setLevel(logging.DEBUG)
|
||||
self._logger.addHandler(ch)
|
||||
self._logger.propagate = False
|
||||
if hasattr(requests, 'logging'):
|
||||
requests.logging.getLogger(requests.__name__).addHandler(ch)
|
||||
rql = requests.logging.getLogger(requests.__name__)
|
||||
rql.addHandler(ch)
|
||||
# Since we have already setup the root logger on debug, we
|
||||
# have to set it up here on WARNING (its original level)
|
||||
# otherwise we will get all the requests logging messanges
|
||||
rql.setLevel(logging.WARNING)
|
||||
|
||||
def use_token_cache(self, use_it):
|
||||
self.os_cache = use_it
|
||||
|
@ -507,11 +507,11 @@ class OpenStackComputeShell(object):
|
||||
if not debug:
|
||||
return
|
||||
|
||||
streamhandler = logging.StreamHandler()
|
||||
streamformat = "%(levelname)s (%(module)s:%(lineno)d) %(message)s"
|
||||
streamhandler.setFormatter(logging.Formatter(streamformat))
|
||||
logger.setLevel(logging.DEBUG)
|
||||
logger.addHandler(streamhandler)
|
||||
# Set up the root logger to debug so that the submodules can
|
||||
# print debug messages
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
format=streamformat)
|
||||
|
||||
def main(self, argv):
|
||||
# Parse args once to find version and debug settings
|
||||
|
Loading…
x
Reference in New Issue
Block a user