Guest post originally published on the Rookout blog by Karl Hughes

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Brian W. Kernigham

Debugging is hard, and in some places—like in the cloud, production, or Java Spring—it’s even harder. Moreover, debugging isn’t just about finding or fixing bugs in code. It also allows developers to better understand existing codebases by allowing them to see the flow of the entire application when starting work on a project they’ve just joined, or to refresh their memory before beginning to code new features. In situations like these, it’s a smart move to begin by running your code in debug mode to ensure you understand the whole flow of the application.

If debugging is the process of removing software bugs, then programming must be the process of putting them in.

Edsger W. Dijkstra

If you want to produce a stable application, debugging is just as important as programming. In order to debug a Spring application, we need to be able to do the following:

In this article, you’ll learn about three things you should be mindful of before you debug your Spring applications, and how a tool like Rookout can make the debugging easier and faster.

What Are Some Java Features Developers Should Be Aware of When Preparing to Debug?

Before you start debugging, you should be aware of some of Java’s features.

To enable the debug mode on the Java Virtual Machine (JVM) for a Maven-based Spring Boot application, you can pass the following command-line arguments to the JVM.

`mvn spring-boot:run"-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=500`

Another option is to provide the following configuration with the Spring Boot Maven plugin in your Maven pom.xml file.

            -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005

After this, all you need is an IDE with support for debugging.

Three Issues You Should Be Aware of When Preparing to Debug a Java/Spring Application

When you’re going to debug your applications remotely, there are some issues you should plan for ahead of time. We’ll cover three of the big ones now, and will also discuss how tools like Rookout can help overcome these challenges.

Remote Debugging

Java is optimized to be debugged locally, and requires care and attention when debugged in non-local environments. Normally, debugging happens in an IDE, which requires a unique setup on a server. This works well if you’re planning to debug the application locally, but it’s an entirely different situation when you have to debug an application running live in production, serving requests. Advanced live debugging options provided by tools like Rookout can help ease the process of remote debugging in production. With Rookout, you can set non-breaking points without stopping your application, and inspect the code without worrying about application performance.

Debugging in a distributed environment

Debugging your application in a distributed environment can be overwhelming. Imagine how challenging it is to track down and isolate a production issue in an application deployed and running on multiple servers. Thankfully, Rookout’s live remote debugging capabilities can help. You don’t even need to SSH to the remote server or redeploy your application after adding tons of log statements. All you need is to connect your application to the tool, and from there on, you can debug it just like you would locally on your laptop.

Debugging cloud-native applications

It’s common nowadays to containerize your Spring applications and run on top of a container orchestrator like Kubernetes. Debugging non-containerized workloads was never easy, and containerization adds an extra layer of complexity. With a new way of deploying and running your cloud-native workloads, the traditional approach to debugging doesn’t work— third party live debugging tools can help you master this new approach.

kubectl describe
kubectl logs
kubectl exec
kubectl port-forward
kubectl debug


Software delivery goes through multiple iterations of testing, but bugs are inevitable, and debugging is one of your best defenses against them. Classic debugging options are still widely used, but tools like Rookout, that provide seamless live debugging capabilities, are the way of the future.