Example #1
0
 def retry_socketstream_connection(self, record):
     self.recreate_socket()
     try:
         self.socket.connect(self.address)
     except socket.error as e:
         """
         this connection error is handled by SyslogHandler
         that basically will try to traceback into sys.stderr
         """
         SysLogHandler.handleError(self, record)
Example #2
0
    def handleError(self, record):
        # not sure if it should check for
        # raiseException and sys.stderr here, just as it's verified in here:
        # https://hg.python.org/cpython/file/2.7/Lib/logging/__init__.py#l808
        ei = sys.exc_info()
        if isinstance(ei[1], socket.error):
            sock_error = ei[1]
            if sock_error.errno == errno.EPIPE and self.is_socketstream_and_not_unixsocket(
            ):
                del ei
                self.retry_socketstream_connection(record)
                """
                    will suppress exception
                    so  wont call the baseclasse handleError in here
                    """
                return

        SysLogHandler.handleError(self, record)