added stdout and stderr redirection to a logfile