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
diff --git a/stack.sh b/stack.sh
index b38c579..154fd76 100755
--- a/stack.sh
+++ b/stack.sh
@@ -598,7 +598,15 @@
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