diff options
author | Dana Powers <dana.powers@rd.io> | 2014-08-17 20:03:24 -0700 |
---|---|---|
committer | Dana Powers <dana.powers@rd.io> | 2014-08-19 21:27:43 -0700 |
commit | 19499c3de62aca699c7abc3f5639b43c96f130c6 (patch) | |
tree | be6e6b4279467d5d63ff12e8bfc150f5f4d3fc36 /kafka/conn.py | |
parent | 45946d872fbbaff5b3d05db124283ec88d95dfbe (diff) | |
download | kafka-python-19499c3de62aca699c7abc3f5639b43c96f130c6.tar.gz |
Add some more debug logging to KafkaConnection
Diffstat (limited to 'kafka/conn.py')
-rw-r--r-- | kafka/conn.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kafka/conn.py b/kafka/conn.py index 3a94581..78fb565 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -76,6 +76,8 @@ class KafkaConnection(local): responses = [] log.debug("About to read %d bytes from Kafka", num_bytes) + + # Make sure we have a connection if self._dirty or not self._sock: self.reinit() @@ -108,6 +110,7 @@ class KafkaConnection(local): try: if self._dirty or not self._sock: self.reinit() + log.debug("Sending payload %s" % (payload,)) sent = self._sock.sendall(payload) if sent is not None: self._raise_connection_error() @@ -142,14 +145,18 @@ class KafkaConnection(local): """ Close this connection """ + log.debug("Closing socket connection for %s:%d" % (self.host, self.port)) if self._sock: self._sock.close() self._sock = None + else: + log.debug("No socket found to close!") def reinit(self): """ Re-initialize the socket connection """ + log.debug("Reinitializing socket connection for %s:%d" % (self.host, self.port)) self.close() try: self._sock = socket.create_connection((self.host, self.port), self.timeout) |