1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-08 18:45:13 +00:00
gcloud-help/gcloud/beta/debug/logpoints/help
2022-03-01 21:43:54 +00:00

89 lines
3.3 KiB
Text

NAME
gcloud beta debug logpoints - commands for interacting with Cloud Debugger
logpoints
SYNOPSIS
gcloud beta debug logpoints COMMAND [--target=(ID|DESCRIPTION_REGEXP)]
[GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Logpoints allow you to inject logging into running services without
restarting or interfering with the normal function of the service. Log
output will be sent to the appropriate log for the target's environment. On
App Engine, for example, output will go to the request log.
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 beta 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 beta 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 beta 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 beta debug logpoints list ID LOCATION ... \
567890abcdef1-1234-56789 product.py:123 ...
$ gcloud beta 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 beta debug logpoints create product.py:123 \
"No description for {product.name}" --format="value(logQuery)")
$ gcloud logging read "$log_query"
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: --help.
Run $ gcloud help for details.
COMMANDS
COMMAND is one of the following:
create
(BETA) Add debug logpoints to a Cloud Debugger debug target (debuggee).
delete
(BETA) Delete debug logpoints for a Cloud Debugger debug target
(debuggee).
list
(BETA) List the debug logpoints for a Cloud Debugger debug target
(debuggee).
NOTES
This command is currently in beta and might change without notice. This
variant is also available:
$ gcloud debug logpoints