gcloud_debug_logpoints (1)
NAME
- gcloud debug logpoints - commands for interacting with Cloud Debugger logpoints
SYNOPSIS
-
gcloud debug logpoints COMMAND [--target=(ID|DESCRIPTION_REGEXP)] [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
FLAGS
-
- --target=(ID|DESCRIPTION_REGEXP)
-
The debug target. It may be a target ID or name obtained from 'debug targets
list', or it may be a regular expression uniquely specifying a debuggee based on
its description or name. For App Engine projects, if not specified, the default
target is the most recent deployment of the default module and version.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
COMMANDS
COMMAND is one of the following:
-
- create
-
Create debug logpoints.
- delete
-
Delete debug logpoints.
- list
-
List debug logpoints.
EXAMPLES
The following command would log the value of the "name" attribute of the "product" variable whenever any request executes line 123 of the file product.py:
-
$ gcloud debug logpoints create product.py:123 \
"No description for {product.name}"
The log output will appear wherever explicit logging output from your program is normally written. For example, for an App Engine Standard application, the output would appear in the request log.
If you want to log output only when certain runtime conditions are met, you can add a "--condition" option:
-
$ gcloud debug logpoints create product.py:123 \
"Suspicious price: {product.name} costs {price}" \
--condition "price < .50"
Logpoints remain active for 24 hours after creation. If you want to disable a logpoint, use the logpoints delete command:
- $ gcloud debug logpoints delete product.*
The above command would delete all logpoints in any file whose name begins with "product". If you want to delete only a single logpoint, you should first determine the logpoint ID using the logpoints list command, then delete that specific ID:
- $ gcloud debug logpoints list ID LOCATION ... 567890abcdef1-1234-56789 product.py:123 ... $ gcloud debug logpoints delete 567890abcdef1-1234-56789
For App Engine services, logpoint resources include the "logQuery" property, which is suitable for use with the "gcloud beta logging read" command. You can save this property's value and use it to read logs from the command line:
-
$ log_query=$(gcloud debug logpoints create product.py:123 \
"No description for {product.name}" \
--format="value(logQuery)") $ gcloud logging read "$log_query"
NOTES
This variant is also available:
- $ gcloud beta debug logpoints