问题
Is there a way to log cypher queries that get generated when we use spring jpa inbuilt queries like findById!? I have a complex inbuilt query whose cypher I need to see
回答1:
Neo4j provides the ability to log all executed queries.
Per https://neo4j.com/docs/operations-manual/current/monitoring/logging/query-logging:
Neo4j can be configured to log queries executed in the database.
Query logging must be enabled by setting the dbms.logs.query.enabled parameter to true. The parameter dbms.logs.query.threshold determines the threshold for logging a query. If the execution of a query takes a longer time than this threshold, it will be logged. Setting dbms.logs.query.threshold to 0 will result in all queries being logged
回答2:
Using Spring Boot 2.1.5, I am able to log Spring Data Neo4j generated Cypher queries just by adding:
logging.level.org.neo4j.ogm.drivers.bolt.request.BoltRequest=DEBUG
to application.properties.
来源:https://stackoverflow.com/questions/56126471/log-cypher-queries