Article DetailsDetailsHelp DetailsEnabling debug logs can help troubleshoot connection issues or driver behaviour while connecting to Aura instances. This should be considered after engaging with the support team and should not be the first element to bring to your support ticket. The items to evaluate initially are the environment and/or the configuration is not the source of issues seen.Please refer to the logging section of our official Python driver manual to know more about the different ways of enabling debug logging. See the example below for how to use it within your code. import sys from neo4j.debug import watch # uncomment below line(s) to get debug logging #watch("neo4j", out=sys.stdout) #Output debug to stdout #watch("neo4j", out=open('debugLogs.txt', 'w')) #Output debug to logfile from neo4j import GraphDatabase # URI examples: "neo4j://localhost", "neo4j+s://xxx.databases.neo4j.io" URI = "neo4j+s://b1cbdd5a.databases.neo4j.io" AUTH = ("neo4j", "football") with GraphDatabase.driver(URI, auth=AUTH) as driver: driver.verify_connectivity() # Get the name of all 42 year-old. Change the MATCH statement below to a query which will return data from your graph records, summary, keys = driver.execute_query( "MATCH (p:Person {age: $age}) RETURN p.name AS name", age=42, database_="neo4j", ) # Loop through results and do something with them for person in records: print(person) # Summary information print("The query `{query}` returned {records_count} records in {time} ms.".format( query=summary.query, records_count=len(records), time=summary.result_available_after, )) in the above and so as to work on your Aura instance you will need to update/change URI = "neo4j+s://1a2b3c4d.databases.neo4j.io" AUTH = ("neo4j", "football") to reflect the correct URI as well as username and password to connect as. Additionally, if you want to get debug logging you will need to uncomment one or both of the lines.Change the name of the debug log output file if necessary #watch("neo4j", out=sys.stdout) #Output debug to stdout #watch("neo4j", out=open('debugLogs.txt', 'w')) #Output debug to logfile Finally, if the connection fails due to a incorrect URI the debug logging will report [ERROR ] [Thread 140178964885504] [Task None ] 2023-12-26 16:58:46,902 Unable to retrieve routing information [DEBUG ] [Thread 140178964885504] [Task None ] 2023-12-26 16:58:46,902 [#0000] _: <POOL> close Traceback (most recent call last): File "/home/neo4j/single/instance1/neo4j-enterprise-5.15.0/bin/py_neo.py", line 15, in <module> driver.verify_connectivity() File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/driver.py", line 1001, in verify_connectivity self._get_server_info(session_config) File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/driver.py", line 1212, in _get_server_info return session._get_server_info() File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/work/session.py", line 172, in _get_server_info self._connect(READ_ACCESS, liveness_check_timeout=0) File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/work/session.py", line 130, in _connect super()._connect( File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/work/workspace.py", line 161, in _connect self._pool.update_routing_table( File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_pool.py", line 802, in update_routing_table raise ServiceUnavailable("Unable to retrieve routing information") neo4j.exceptions.ServiceUnavailable: Unable to retrieve routing information if connection fails as a result of incorrect username/password the debug logging will report File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt5.py", line 579, in hello self.fetch_all() File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 863, in fetch_all detail_delta, summary_delta = self.fetch_message() File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 849, in fetch_message res = self._process_message(tag, fields) File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt5.py", line 374, in _process_message response.on_failure(summary_metadata or {}) File "/home/neo4j/.local/lib/python3.10/site-packages/neo4j/_sync/io/_common.py", line 281, in on_failure raise Neo4jError.hydrate(**metadata) neo4j.exceptions.AuthError: {code: Neo.ClientError.Security.Unauthorized} {message: The client is unauthorized due to authentication failure.} neo4j@ubuntu22dockerdebjava17:~/single/instance1/neo4j-enterprise-5.15.0/bin$ InformationTitleHow to Enable Debug logs for the Neo4j Python Driver?Article Created Date3/15/2024, 10:57 PMURL Name10550176964243-How-to-Enable-Debug-logs-for-the-Neo4j-Python-DriverLast Modified Date5/6/2024, 6:38 AM