summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kafka/conn.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/kafka/conn.py b/kafka/conn.py
index af01efa..16e9238 100644
--- a/kafka/conn.py
+++ b/kafka/conn.py
@@ -7,7 +7,7 @@ import logging
from random import shuffle, uniform
import socket
import time
-import traceback
+import sys
from kafka.vendor import six
@@ -614,8 +614,10 @@ class BrokerConnection(object):
"""
if self.state is ConnectionStates.DISCONNECTED:
if error is not None:
- log.warning('%s: close() called on disconnected connection with error: %s', self, error)
- traceback.print_stack()
+ if sys.version_info >= (3, 2):
+ log.warning('%s: close() called on disconnected connection with error: %s', self, error, stack_info=True)
+ else:
+ log.warning('%s: close() called on disconnected connection with error: %s', self, error)
return
log.info('%s: Closing connection. %s', self, error or '')