Besu : Debugging Besu in IntelliJ

Running Besu in debug mode within your IDE can be very useful as this allows you to set breakpoints on certain lines. You can also debug your forked version of the Besu repo in your current branch to confirm the behaviour of any intended changes. To do this in IntelliJ:

  • Search for the Besu class (shortcut: command + O and enter ‘Besu’).

  • Click on the green triangle to the left of the main method within the Besu class and select Modify Run Configuration to add CLI arguments as you would when running Besu on the terminal. Press apply and OK once done.

  • Click on the green triangle again and select Debug ‘Besu.main()’.

Advanced: if you want to debug acceptance tests (that run multiple besu nodes in a cluster), you need to be using ThreadBesuNodeRunner as opposed to ProcessBesuNodeRunner which is the default.