Try to create a socket, using an exponential backoff with a max retry time. Thanks to Robert Olson for the original patch (SF #815911) which has been slightly refactored.
logging.handlers/SocketHandler.createSocket
SocketHandler.createSocket