Skip to content

Commit 50cb9d5

Browse files
committed
Log failed attempts of opening a connection
1 parent c409adc commit 50cb9d5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

neo4j/io/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,14 @@ def connect(address, *, timeout, custom_resolver, ssl_context, keep_alive):
13801380
s = _secure(s, resolved_address.host_name, ssl_context)
13811381
return _handshake(s, resolved_address)
13821382
except (BoltError, DriverError, OSError) as error:
1383+
try:
1384+
local_port = s.getsockname()[1]
1385+
except (OSError, AttributeError):
1386+
local_port = 0
1387+
err_str = error.__class__.__name__
1388+
if str(error):
1389+
err_str += ": " + str(error)
1390+
log.debug("[#%04X] C: <CONNECTION FAILED> %s", local_port, err_str)
13831391
if s:
13841392
_close_socket(s)
13851393
errors.append(error)

0 commit comments

Comments
 (0)