summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Treinish <mtreinish@kortar.org>2015-03-11 15:54:58 -0400
committerMatthew Treinish <mtreinish@kortar.org>2015-03-11 19:05:50 -0400
commite8be46fbf848d319793837c01b3bfb7d36c09227 (patch)
tree09a2f373a1a3bbc39636cd1f034859d96a50cba8
parent4c4d34b2b0d70e0c92f568a0080eff0df49f096f (diff)
downloadtempest-lib-e8be46fbf848d319793837c01b3bfb7d36c09227.tar.gz
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
-rw-r--r--tempest_lib/common/rest_client.py30
1 files 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'] = '<omitted>'
- 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)