HI, I was new to procedures and was trying to debug the procedures that i’ve wrote. can someone suggest on how to do that.?

procedure

(Phanindhar Bodla) #1

HI, I was new to procedures and was trying to debug the procedures that i’ve wrote. can someone suggest on how to do that.?


(Michael Hunger) #2

Usually you write a unit or integration test that uses the procedure, and then if the test fails, you can set break-points in your IDE and debug the code.

The procedure example repository helps you to get set-up:

And the manual walks through writing and testing procedures, see the about message on top of the #neo4j-graph-platform:procedures-apoc category.


(Phanindhar Bodla) #3

Thanks a ton micheal for the prompt reply. This community is awesome. Used the above example, enabled debug listener using https://neo4j.com/docs/java-reference/3.4/server-debugging/ and I was able debug with breakpoint in my procedure.

In order to configure the Neo4j server for remote debugging sessions, the Java debugging parameters need to be passed to the Java process through the configuration. They live in the conf/neo4j.conf file.

In order to specify the parameters, add a line for the additional Java arguments like this:

dbms.jvm.additional=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

This configuration will start a Neo4j server ready for remote debugging attachement at localhost and port 5005 . Use these parameters to attach to the process from Eclipse, IntelliJ or your remote debugger of choice after starting the server.


(Michael Hunger) #4

Yes that's useful for determining issues with existing setups / datasets.

In general I still suggest to debug / fix issues using unit tests.


(Andrew Bowman) #5

The Neo4j Procedure Compiler may be useful here too, at least to catch the early kinds of errors at compilation.