I want to see the query being executed by the embedded Neo4j database using spring data in a JUnit test. How would I go about doing this?
Asked
Active
Viewed 441 times
4
-
Also, is there anyway to enable logging for neo4j libraries? Not the server log but debug logs for neo4j api. – Aravind Yarram Jul 08 '13 at 16:48
2 Answers
0
I am using slf4j together with log4j for console logging in my junit test cases. Putting the following logger configuration to a log4j.xml file I get a more detailed output for the spring-data-neo4j part:
<logger name="org.springframework.data">
<level value="debug" />
</logger>
<logger name="org.springframework.persistence">
<level value="debug" />
</logger>
The output includes detailed information about derived queries e.g. from the repositories:
23.08.2013 09:22:27 DEBUG DerivedCypherRepositoryQuery - Derived query: START `document`=node({0}) WHERE (has(`document`.__type__) AND `document`.__type__ IN ['my.package.Document']) RETURN `document`from method Repository-Graph-Query-Method for public abstract my.package.Document my.package.repositories.DocumentRepository.getDocumentByDocumentId(java.lang.Long)

Henrik Sachse
- 51,228
- 7
- 46
- 59
0
<logger name="org.springframework.data.neo4j">
<level value="debug"/>
</logger>

Mike Holdsworth
- 1,088
- 11
- 12