One of the oldest questions as a developer, I think is: "Why does this code not work as expected?"
And one of the first things we all do is to set a breakpoint and check what's happening 🧐
Of course, you can also write Java code for your processes in Axon Ivy and sometimes you would like to see what is going on. So let's see how you can do so:
Log output 📝
One of the simplest and fastest ways to achieve something like it is to add a log entry to your code and check the
Runtime Log view for this entry:
ivy.log.info(">> test log: " + myVariable);
Start debug session 🔗
You can also start a debug session where you can set breakpoints to your Java code, but as we don't support this out of the box you need to do this with a little "trick".
First, you need to add the following JVM argument to the
This line permits a remote debugger to connect with the JVM on port
Now please restart your Designer
At last, you need to add a new
Remote Java Application debug configuration, by:
Run menu and then click on
Create a new
Remote Java Application configuration
Select the project you want to debug
Select the host and the port (localhost and 8001)
Start the debug session by a click on the
Debug button (or over the
ℹ️ Tip: If you don't see any
Debug Configurations entry in the
Run menu, you can also find it over the Quick Search (via the magnifying glass at the top right or with the key combination Ctrl+3).
Write a JUnit test 🤖
Last but not least, you always have the possibility to write a simple JUnit test for your Java code. Especially if you have complex logic, it may be worth testing it properly. If you start a JUnit test, you can always set breakpoints and debug your code.
For more, check out our Testing documentation.