'Handle an error during logging.
An error has occurred during logging. Most likely cause -
connection lost. Close the socket so that we can retry on the
next event.'

def handleError(self, record):

    if (self.closeOnError and self.sock):
        self.sock.close()
        self.sock = None
    else:
        logging.Handler.handleError(self, record)
    return
