

Now that we have some breakpoints, let’s invoke the onos:app command and let’s see what happens. Note how the auto-completion works nicely here. We’ll chose to log our own message, which prints out a message with the value of the appId field. Doing that will reveal a number of logging options. Let’s try this out by setting another breakpoint on line 90 and then turn off the Suspend check-box. Logging break-pointsĪlternatively, we can turn a breakpoint into a logging one, which means that it will log a value of an expression, rather than suspend the program execution. Let’s make our breakpoint conditional on the name of the application ending with the “.fwd” string. To turn a breakpoint into a conditional one, we just need to type a Java boolean expression into the Condition field. Let’s do this for our break-point.Īnother useful breakpoint functionality is the ability to break only when a certain condition is met.
#Intellij idea debug free
Because other threads are free to continue execution, you are less likely to disrupt normal processing paths, due to missed heart-beats or time-outs. One useful customization is to change the break-point so that it suspends only the executing Thread rather than all threads in the VM.

To customize a break-point we can simply right-click on it and then tailor its properties. Let’s open this file and let’s set a breakpoint on line 60. In our example, we will set some breakpoints in the ApplicationCommand.java, which is a CLI handler for the onos:app command.
#Intellij idea debug code
To do that we simply need to click in the left-hand margin of the code editor. Setting break-pointsĪt this point, we are ready to start setting breakpoints in our code. This will immediately open the Debug console with a message that IntelliJ has connected to the target virtual machine on localhost and on port 5005. Now all we need to do to attach the debugger to the ONOS process is to press the debug button. Note that the newly created debug configuration has been selected in the upper right hand corner. Let’s press OK to apply the changes and to close the dialog. If we were debugging ONOS running on another machine we would simply specify the IP address or DNS name of that machine here. Since we’ll be debugging local ONOS, let’s name our configuration Local and let’s leave the default Host address as localhost. While ONOS is starting up, let’s switch to IntelliJ IDEA and from the Run menu, select Edit Configurations… Then, let’s add a new configuration by pressing the + sign and select the Remote configuration. Attaching IntelliJ IDEA to the remote ONOS process In our demonstration, we will use the locally run ONOS, so let’s start it. Installations deployed via the onos-install utility already include the debug option by default.
