Don't buffer log output in sed

Services that run inside Apache use tail -f on the corresponding log
file to display output in the screen session. However, they also use sed
to replace some control characters, and this means that the output is
buffered. This results in debugging experiences that range from
"impossible" (the log you want isn't shown) to "Kafkaesque nightmare"
(the log you want isn't shown, except that sometimes it is, and
sometimes it isn't even though you double-checked and you're completely
sure that you must have output a log, but when you check back later you
realise it actually is and you wonder if history is actually not mutable
after all and begin to question what is real and what is not).

This adds the --unbuffered option to ensure streaming output.

Change-Id: I665ff5f047156401d8152f478d834ac40ff31658
This commit is contained in:
Zane Bitter 2016-12-20 17:29:14 -05:00
parent 894cbd6545
commit 95ed7c6f05

View File

@ -1678,7 +1678,7 @@ function tail_log {
local logfile=$2 local logfile=$2
if [[ "$USE_SCREEN" = "True" ]]; then if [[ "$USE_SCREEN" = "True" ]]; then
screen_process "$name" "sudo tail -f $logfile | sed 's/\\\\\\\\x1b/\o033/g'" screen_process "$name" "sudo tail -f $logfile | sed -u 's/\\\\\\\\x1b/\o033/g'"
fi fi
} }