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?

4

2 回答 2

0

我在我的 junit 测试用例中使用 slf4j 和 log4j 进行控制台日志记录。将以下记录器配置放入 log4j.xml 文件中,我得到了 spring-data-neo4j 部分的更详细的输出:

<logger name="org.springframework.data">
    <level value="debug" />
</logger>
<logger name="org.springframework.persistence">
    <level value="debug" />
</logger>

输出包括有关派生查询的详细信息,例如来自存储库:

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)
于 2013-08-23T07:30:13.090 回答
0
<logger name="org.springframework.data.neo4j">
    <level value="debug"/>
</logger>
于 2013-08-28T00:25:21.740 回答