log connection loss and error event