write errors to log file