redirect stdout and stderr to log file