Browse code

Merge "Add a timestamp to the log output for better diagnosis"

Jenkins authored on 2012/12/11 01:16:01
Showing 1 changed files
... ...
@@ -598,7 +598,15 @@ if [[ -n "$LOGFILE" ]]; then
598 598
     exec 3>&1
599 599
     if [[ "$VERBOSE" == "True" ]]; then
600 600
         # Redirect stdout/stderr to tee to write the log file
601
-        exec 1> >( tee "${LOGFILE}" ) 2>&1
601
+        exec 1> >( awk '
602
+                {
603
+                    cmd ="date +\"%Y-%m-%d %H:%M:%S \""
604
+                    cmd | getline now
605
+                    close("date +\"%Y-%m-%d %H:%M:%S \"")
606
+                    sub(/^/, now)
607
+                    print
608
+                    fflush()
609
+                }' | tee "${LOGFILE}" ) 2>&1
602 610
         # Set up a second fd for output
603 611
         exec 6> >( tee "${SUMFILE}" )
604 612
     else