logfile was only written on connection errors and not as planned if there were no errors