4

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?

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
user1325194
  • 175
  • 2
  • 3
  • 12

2 Answers2

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