fixes #4163

Rebased-by: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-from: 90fd873
Switch stdout to line buffering

Use line buffering (instead of block buffering) so that messages arrive
immediately in systemd-journald, tail -f debug.log, and the like.

Rebased-By: Wladimir J. van der Laan <laanwj@gmail.com>
Rebased-From: 283e405