From cc14efd5df57081b73cd3f4be7c230ab6c2adb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Sat, 9 Apr 2016 18:12:33 +0200 Subject: [PATCH] Only do tracer logging if there are handlers Fixes #391, thanks cp2587 for the report! --- elasticsearch/connection/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elasticsearch/connection/base.py b/elasticsearch/connection/base.py index 82339345..3a962c9b 100644 --- a/elasticsearch/connection/base.py +++ b/elasticsearch/connection/base.py @@ -65,7 +65,7 @@ class Connection(object): logger.debug('> %s', body) logger.debug('< %s', response) - if tracer.isEnabledFor(logging.INFO): + if tracer.isEnabledFor(logging.INFO) and tracer.hasHandlers(): # include pretty in trace curls path = path.replace('?', '?pretty&', 1) if '?' in path else path + '?pretty' if self.url_prefix: