write output to logfile