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:
-
Make sure you have version 1.9.20 or later of the Google App Engine SDK installed on your local workstation.
-
Commit and push your source code to your Git repository (a Cloud Source Repository or connected Github or Bitbucket repository):
$ git commit -m 'Commit message.' $ git push google master -
Build and test your application using Maven or another build tool.
-
Deploy your application using the
appcfgcommand:$ 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