Is there a way to register requests on Neo4J as Hibernate?

So here is the scenario:

  • I have a Neo4J server working locally with some data in it
  • I have a web application using spring-data-neo4j

The following code is based on the Cineasts code example :

 public interface CrewRepository extends GraphRepository<Crew> { Iterable<Crew> findByNameLike(String name); @Query("start thinker=node({0}) match thinker-[:crews]-crews return crews") Set<Crew> findByThinker(Long thinkerId); } 

No news here. The problem is that the findByNameLike request findByNameLike not work, and findByThinker does.

I modified my log configuration file several times β€” the final version β€” below, but it doesn’t matter what I try, I don’t see any requests that are logged β€” either in my log file or on the server.

 <logger name="org.neo4j"> <level value="DEBUG" /> <appender-ref ref="console" /> </logger> <logger name="org.springframework.data.neo4j"> <level value="DEBUG" /> <appender-ref ref="console" /> </logger> <root> <priority value="error" /> <appender-ref ref="console" /> </root> 

All I want is a query log so that I can see if this is an error on spring-data-neo4j , or if I missed something ... I looked at the documentation of both, code examples and could not find anything specifically.

Any help? Thanks!

+4
source share
2 answers

You can enable query logging by adding the following lines to your log4j.xml:

 <logger name="org.springframework.data.neo4j.support.query"> <level value="debug" /> </logger> 
+5
source

If someone lands here to learn how to log requests when remotely accessing a Neo4j server through a REST API, use

 <logger name="org.springframework.data.neo4j.rest.SpringRestCypherQueryEngine"> <level value="debug" /> </logger> 

If you are using Spring Data Neo4j and want to see derived queries matching your DAO methods,

 <logger name="org.springframework.data.neo4j.repository.query.DerivedCypherRepositoryQuery"> <level value="debug" /> </logger> 
+3
source

Source: https://habr.com/ru/post/1392281/


All Articles