From e5eee5834b4ae62857830a7a0266df76ec640b2d Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 6 Dec 2012 09:47:53 -0500 Subject: [PATCH] Add a timestamp to the log output for better diagnosis when we are looking at logs generated by the gate jobs we need timestamps on the output of stack.sh so we can figure out what was being executed around the time when there was a problem in say nova-network Change-Id: I203e8dae97715d6ee46a4088c7577b9be66cf09d --- stack.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/stack.sh b/stack.sh index b38c579161..154fd76fb7 100755 --- a/stack.sh +++ b/stack.sh @@ -598,7 +598,15 @@ if [[ -n "$LOGFILE" ]]; then exec 3>&1 if [[ "$VERBOSE" == "True" ]]; then # Redirect stdout/stderr to tee to write the log file - exec 1> >( tee "${LOGFILE}" ) 2>&1 + exec 1> >( awk ' + { + cmd ="date +\"%Y-%m-%d %H:%M:%S \"" + cmd | getline now + close("date +\"%Y-%m-%d %H:%M:%S \"") + sub(/^/, now) + print + fflush() + }' | tee "${LOGFILE}" ) 2>&1 # Set up a second fd for output exec 6> >( tee "${SUMFILE}" ) else