I have a socket logging handler and I want to be able to catch exceptions from it. Specifically, I want to know if the remote side has gone away so I can close the socket and reopen it when the remote side come back.
What happens now is that I get Broken pipe and BAD_WRITE_RETRY exceptions, but it's not coming from any functions I directly call. is there any way to catch these? Traceback (most recent call last): File "/home/ecovent/python2.7.9/lib/python2.7/logging/handlers.py", line 579, in emit self.send(s) File "/home/ecovent/python2.7.9/lib/python2.7/logging/handlers.py", line 520, in send self.sock.sendall(s) File "/home/ecovent/python2.7.9/lib/python2.7/ssl.py", line 701, in sendall v = self.send(data[count:]) File "/home/ecovent/python2.7.9/lib/python2.7/ssl.py", line 667, in send v = self._sslobj.write(data) SSLError: [SSL: BAD_WRITE_RETRY] bad write retry (_ssl.c:1625) Traceback (most recent call last): File "/home/ecovent/python2.7.9/lib/python2.7/logging/handlers.py", line 579, in emit self.send(s) File "/home/ecovent/python2.7.9/lib/python2.7/logging/handlers.py", line 520, in send self.sock.sendall(s) File "/home/ecovent/python2.7.9/lib/python2.7/ssl.py", line 701, in sendall v = self.send(data[count:]) File "/home/ecovent/python2.7.9/lib/python2.7/ssl.py", line 667, in send v = self._sslobj.write(data) error: [Errno 32] Broken pipe -- https://mail.python.org/mailman/listinfo/python-list