Skip to content

Connection logging cleanups #1432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions kafka/conn.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def connect(self):
self.state = ConnectionStates.AUTHENTICATING
else:
# security_protocol PLAINTEXT
log.debug('%s: Connection complete.', self)
log.info('%s: Connection complete.', self)
self.state = ConnectionStates.CONNECTED
self._reset_reconnect_backoff()
self.config['state_change_callback'](self)
Expand All @@ -343,7 +343,8 @@ def connect(self):
elif ret not in (errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK, 10022):
log.error('Connect attempt to %s returned error %s.'
' Disconnecting.', self, ret)
self.close(Errors.ConnectionError(ret))
errstr = errno.errorcode.get(ret, 'UNKNOWN')
self.close(Errors.ConnectionError('{} {}'.format(ret, errstr)))

# Connection timed out
elif time.time() > request_timeout + self.last_attempt:
Expand All @@ -361,7 +362,7 @@ def connect(self):
log.debug('%s: initiating SASL authentication', self)
self.state = ConnectionStates.AUTHENTICATING
else:
log.debug('%s: Connection complete.', self)
log.info('%s: Connection complete.', self)
self.state = ConnectionStates.CONNECTED
self.config['state_change_callback'](self)

Expand All @@ -370,7 +371,7 @@ def connect(self):
if self._try_authenticate():
# _try_authenticate has side-effects: possibly disconnected on socket errors
if self.state is ConnectionStates.AUTHENTICATING:
log.debug('%s: Connection complete.', self)
log.info('%s: Connection complete.', self)
self.state = ConnectionStates.CONNECTED
self._reset_reconnect_backoff()
self.config['state_change_callback'](self)
Expand Down