diff --git a/elasticsearch/connection/thrift.py b/elasticsearch/connection/thrift.py index 77866a62..1fa59449 100644 --- a/elasticsearch/connection/thrift.py +++ b/elasticsearch/connection/thrift.py @@ -1,6 +1,7 @@ from __future__ import absolute_import from socket import timeout as SocketTimeout import time +import logging try: from .esthrift import Rest @@ -16,6 +17,8 @@ except ImportError: from ..exceptions import ConnectionError, ImproperlyConfigured from .pooling import PoolingConnection +logger = logging.getLogger('elasticsearch') + class ThriftConnection(PoolingConnection): """ Connection using the `thrift` protocol to communicate with elasticsearch. @@ -69,8 +72,11 @@ class ThriftConnection(PoolingConnection): try: # try closing transport socket tclient.transport.close() - except: - pass + except Exception as e: + logger.warning( + 'Exception %s occured when closing a failed thrift connection.', + e, exc_info=True + ) raise ConnectionError('N/A', str(e), e) self._release_connection(tclient)