Redirect stdout to logfile