Support log redirection to a file.
Use line buffering on log files.
This makes sure the contents are written on the disk, so the user can
read the log.