From e8be46fbf848d319793837c01b3bfb7d36c09227 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Wed, 11 Mar 2015 15:54:58 -0400 Subject: Always print info logs from the rest client requests The info logs make it very easy to parse the requests in tempest log file. However on gate runs we run tempest with debug so we can see the full req and resp for ever call. However it makes the log just a mess of debug statements and difficult to trace through by hand. This commit adds the info summary messages back even if debug is set so that we can trace through. There will be a slight duplication of logging, but it is worth the tradoff. Change-Id: I5499f231a91342a184d254e95bc72a7480a0ece0 Depends-On: Ia0de957b681cb924a57af98d99a9389ee234ed5b --- tempest_lib/common/rest_client.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/tempest_lib/common/rest_client.py b/tempest_lib/common/rest_client.py index e60d899..dab8cc1 100644 --- a/tempest_lib/common/rest_client.py +++ b/tempest_lib/common/rest_client.py @@ -225,19 +225,13 @@ class RestClient(object): caller_name=None, extra=None): if 'X-Auth-Token' in req_headers: req_headers['X-Auth-Token'] = '' - log_fmt = """Request (%s): %s %s %s%s - Request - Headers: %s + log_fmt = """Request - Headers: %s Body: %s Response - Headers: %s Body: %s""" self.LOG.debug( log_fmt % ( - caller_name, - resp['status'], - method, - req_url, - secs, str(req_headers), self._safe_body(req_body), str(resp), @@ -258,20 +252,20 @@ class RestClient(object): caller_name = misc_utils.find_test_caller() if secs: secs = " %.3fs" % secs - if not self.LOG.isEnabledFor(real_logging.DEBUG): - self.LOG.info( - 'Request (%s): %s %s %s%s' % ( - caller_name, - resp['status'], - method, - req_url, - secs), - extra=extra) + self.LOG.info( + 'Request (%s): %s %s %s%s' % ( + caller_name, + resp['status'], + method, + req_url, + secs), + extra=extra) # Also look everything at DEBUG if you want to filter this # out, don't run at debug. - self._log_request_full(method, req_url, resp, secs, req_headers, - req_body, resp_body, caller_name, extra) + if self.LOG.isEnabledFor(real_logging.DEBUG): + self._log_request_full(method, req_url, resp, secs, req_headers, + req_body, resp_body, caller_name, extra) def _parse_resp(self, body): body = json.loads(body) -- cgit v1.2.1