adding logfile output on error