Skip to content
Browse files

Make immune against log statements that are temporarily out of order.…

… Improved log output formatting.
  • Loading branch information...
1 parent 3e6606d commit 4ba0f2fb73f3e634c8bdaf5bcea51bf91a8aa22d Adrian Lienhard committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 apache-log-replay.py
View
6 apache-log-replay.py
@@ -28,6 +28,8 @@ def _replay(requests, speedup):
print "%d requests to go (time: %s)" % (len(requests), total_delta)
last_time = requests[0][0]
for request_time, host, path in requests:
+ if request_time < last_time:
+ request_time = last_time
time_delta = (request_time - last_time) // speedup
if time_delta:
if time_delta and time_delta.seconds > 10:
@@ -40,8 +42,8 @@ def _replay(requests, speedup):
urllib2.urlopen(url)
except Exception:
req_result = "FAILED"
- print ("[%s] REQUEST: %s -- %s"
- % (request_time.strftime("%H:%M:%S"), url, req_result))
+ print ("[%s] %s -- %s"
+ % (request_time.strftime("%H:%M:%S"), req_result, url))
def _setup_http_client(proxy):
"""Configure proxy server and install HTTP opener"""

0 comments on commit 4ba0f2f

Please sign in to comment.
Something went wrong with that request. Please try again.