Using Cloud Debugger

Cloud Debugger can capture and inspect the call stack and local variables of a live application running in the cloud, on a variety of platforms like App Engine, Compute Engine, GKE, and Cloud Run, without stopping the app or slowing it down.

It works much like your IDE's standard debugger, and provides the same user interface, with two key differences:

  • Debugger does not pause execution of the running application.
  • You cannot step through an application in Debugger.

For more about the platforms Debugger support, refer to this guide.


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 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. Click the green bug "debug" icon in the toolbar to start the debugger.
  8. In the Attach to an Application dialog, select the backend module you want to debug and 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 you want to watch.
  2. Click the executable lines 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 mark the snapshot location, and the Debugger Snapshots pane displays pending snapshots.

  3. Click the blue circle to remove the snapshot location.

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 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 you need to debug a problem is not 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 above.

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.