Setting Up Stackdriver Debugger on App Engine (Java)

Stackdriver Debugger is enabled automatically for Java applications running on Google App Engine standard environment. It is enabled with a statement in the app.yaml file of apps running on App Engine flexible environment.

Configuring flexible environment

When using Google App Engine flexible environment, add the following to your application's app.yaml file:

env_variables:
 DBG_ENABLE: true

This statement is not required for apps in the standard environment.

Build, push and deploy your application

For both standard and flexible environment:

  1. Make sure you have version 1.9.20 or later of the Google App Engine SDK installed on your local workstation.

  2. Commit and push your source code to your Git repository:

    $ git commit -m 'Commit message.'
    $ git push google master
    
  3. Build and test your application using Maven or another build tool.

  4. Deploy your application using the appcfg command:

    $ appcfg.sh update [WAR_LOCATION]
    

    For example:

    $ appcfg.sh update ./target/myapp
    

The appcfg command generates a file named WEB-INF/classes/source-context.json and uploads it with your application. This file contains information about the version of the source code used to build the application. When you open Stackdriver Debugger in the Google Cloud Platform Console, it uses the information in this file to display the correct version of the source.

Using the debugger

After deployment, you can use Stackdriver Debugger to capture and inspect the call stack and local variables in your application.

Note that information about members of App Engine framework classes and private members of system classes is not displayed by Stackdriver Debugger. Attempting to inspect these objects returns a notice:

Non-public fields of system classes omitted

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Stackdriver Debugger Documentation