Collect the output to a log file (can be useful for debugging).