Cloud Debugger can capture and inspect the call stack and local variables of a live application running in the cloud without stopping the app or slowing it down. Debugger supports Google Cloud products including App Engine, Compute Engine, GKE, and Cloud Run.
Debugger works much like your IDE's standard debugger and provides the same user interface, with the following key differences:
- Debugger doesn't pause execution of the running application.
- You can't step through an application in Debugger.
For more information about the platforms Debugger supports, see Setting up the Debugger.
Requirements
To run the Debugger, you need the following:
- Cloud Code
- Java 7 or 8
- Git
- A Google account that can deploy App Engine apps
Using the Debugger
To use the Debugger:
- Open your project inside IntelliJ.
- Click Run > Edit Configurations.
- Click + Add New Configuration in the upper left corner and then select Google Cloud Debugger from the dropdown list.
- Enter a name for your configuration in the Name field.
- Make sure that your project is selected in the Project field.
- Click OK.
- To start the debugger, click
Debug in the toolbar.
- In the Attach to an Application dialog, select the backend module that you want to debug and then click Attach.
Setting a snapshot location
A snapshot captures the local variables and call stack at the specified location in your source code. The snapshot location applies to all running instances of your application.
To set a snapshot location:
- After attaching Debugger to a running application, navigate to the file that contains the source code that you want to watch.
- Click the executable line that you want to snapshot in the left gutter area, just as you
would when setting a line breakpoint for a local application using the regular IDEA debugger.
- In the Set Breakpoint dialog that appears, select Cloud Snapshot Location. A blue circle appears in the gutter to indicate the snapshot location and the Debugger Snapshots pane displays pending snapshots.
- To disable the snapshot location, right-click the blue circle and clear the Enabled checkbox.
- To remove the snapshot location, click the blue circle.

Getting the snapshot
The first time any instance executes the code at the snapshot location you set, the debugger takes a snapshot and makes it available for viewing. You can then examine the snapshot and use the data to debug your application.
The label on the snapshot in the Debugger Snapshots pane changes from Pending to the time when Debugger captured the snapshot.
Advanced concepts
Set a snapshot condition
A snapshot condition is a boolean expression that tells the debugger to take a snapshot only
when it evaluates to true. For example, x !=0
. The condition is a full boolean
expression that can include logical and numeric operators, for example,
score < 0 || score > 500
.
To set a snapshot condition:
- Right-click the Cloud Snapshot Location (the blue circle) in the gutter.
- In the Condition field, enter the condition.
Watch expressions
Sometimes the information that you need to debug a problem isn't immediately apparent in the
application's local variables and fields. In particular, when running on App Engine, the
Security Manager prevents you from delving too deeply into the private members of system classes
such as java.util.Hashmap
. In cases like this, a watch expression serves as an
effective temporary local variable to expose additional information. Watch expressions can
evaluate complex expressions and traverse object hierarchies when a snapshot is taken.
You can specify a watch expression after you have set the snapshot location. Watch expressions support the same language features as snapshot conditions, described in the Set a snapshot condition section.
Get support
To submit feedback or report an issue in your IntelliJ IDE, go to Tools > Cloud Code > Help / About > Submit feedback or report an issue to report an issue on GitHub, or ask a question on Stack Overflow.You can also join the #cloud-code
channel, which is part of the Google Cloud Slack community.