Using Cloud Debugger

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.


To run the Debugger, you need the following:

Using the Debugger

To use the Debugger:

  1. Open your project inside IntelliJ.
  2. Choose Run > Edit Configurations.
  3. Click the plus sign (+) in the upper left corner and then select Cloud Debugger from the dropdown list.
  4. Type a name for your configuration in the Name field.
  5. Make sure that your project is selected in the Project field.
  6. Click OK.
  7. To start the debugger, click the green bug Debug Debug icon icon in the toolbar.
  8. 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:

  1. After attaching Debugger to a running application, navigate to the file that contains the source code that you want to watch.
  2. Click the executable lines 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.

    A blue circle appears in the gutter to indicate the snapshot location and the Debugger Snapshots pane displays pending snapshots.

  3. To remove the snapshot location, click the blue circle.

In the following example, the snapshot location is set on the line if (userAgent != null) {.

Set a snapshot location

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.

View stack trace

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.

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.

Getting 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.