diff options
author | Dana Powers <dana.powers@gmail.com> | 2017-03-06 11:01:49 -0800 |
---|---|---|
committer | Dana Powers <dana.powers@gmail.com> | 2017-03-06 11:01:49 -0800 |
commit | 8ebb646be9679f740ac6a90a6c395f2161b836a0 (patch) | |
tree | d7e4aba847f952c2ed939c2e7be0147fb4de9f6f | |
parent | 2eb32ddc79de0c2d33d80ad76705503eb42b9ea4 (diff) | |
download | kafka-python-8ebb646be9679f740ac6a90a6c395f2161b836a0.tar.gz |
Add more debug-level connection logging
-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 7c3dbb5..d88e97c 100644 --- a/kafka/conn.py +++ b/kafka/conn.py @@ -262,11 +262,13 @@ class BrokerConnection(object): self._sock = socket.socket(self._init_afi, socket.SOCK_STREAM) for option in self.config['socket_options']: + log.debug('%s: setting socket option %s', self, option) self._sock.setsockopt(*option) self._sock.setblocking(False) if self.config['security_protocol'] in ('SSL', 'SASL_SSL'): self._wrap_ssl() + log.debug('%s: connecting to %s:%d', self, self.host, self.port) self.state = ConnectionStates.CONNECTING self.last_attempt = time.time() self.config['state_change_callback'](self) @@ -293,8 +295,10 @@ class BrokerConnection(object): log.debug('%s: initiating SSL handshake', self) self.state = ConnectionStates.HANDSHAKE elif self.config['security_protocol'] == 'SASL_PLAINTEXT': + log.debug('%s: initiating SASL authentication', self) self.state = ConnectionStates.AUTHENTICATING else: + log.debug('%s: Connection complete.', self) self.state = ConnectionStates.CONNECTED self.config['state_change_callback'](self) @@ -318,8 +322,10 @@ class BrokerConnection(object): if self._try_handshake(): log.debug('%s: completed SSL handshake.', self) if self.config['security_protocol'] == 'SASL_SSL': + log.debug('%s: initiating SASL authentication', self) self.state = ConnectionStates.AUTHENTICATING else: + log.debug('%s: Connection complete.', self) self.state = ConnectionStates.CONNECTED self.config['state_change_callback'](self) @@ -327,6 +333,7 @@ class BrokerConnection(object): assert self.config['security_protocol'] in ('SASL_PLAINTEXT', 'SASL_SSL') if self._try_authenticate(): log.info('%s: Authenticated as %s', self, self.config['sasl_plain_username']) + log.debug('%s: Connection complete.', self) self.state = ConnectionStates.CONNECTED self.config['state_change_callback'](self) |