From 1bf4a1cab2772acb9656a47b4ed959261970e459 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Fri, 4 Sep 2026 22:43:02 +0000 Subject: [PATCH 01/26] adding plugin info and rewriting for clarity --- docs/observability/logging.md | 329 ++++++++++++++++++++-------------- 1 file changed, 194 insertions(+), 135 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index d93869f177..e84e58e9e5 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -120,188 +120,247 @@ You can enable GCP export using the `--otel_to_cloud` flag: adk web --otel_to_cloud path/to/your/agents_dir ``` -### Python programmatic setup +### Activity logging with plugins -In Python, ADK uses the standard `logging` module and OpenTelemetry for -structured GenAI logs. +ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and session state) without modifying your agent logic. -#### Logging level +#### Console logging with `LoggingPlugin` -To enable detailed logging, including `DEBUG` level messages, add the following -to the top of your script: +To print structured activity logs to the console during execution, attach `LoggingPlugin` to your `App`: -```python -import logging +=== "Python" -logging.basicConfig( - level=logging.DEBUG, - format='%(asctime)s - %(levelname)s - %(name)s - %(message)s' -) -``` + ```python + from google.adk.apps import App + from google.adk.plugins import LoggingPlugin -#### Capture prompt content + app = App( + name="my_app", + root_agent=root_agent, + plugins=[LoggingPlugin()], + ) + ``` -You can enable full prompt logging programmatically by setting an environment -variable: +=== "Kotlin" -```python -import os + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" + ``` -os.environ["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"] = "true" -``` +#### Full debug capture to a file with `DebugLoggingPlugin` -To scope content capture to a single run instead of the whole process, set -`RunConfig.telemetry` rather than the environment variable: +
+ Supported in ADKPython v1.23.0Kotlin v0.6.0 +
-```python -from google.adk.agents.run_config import RunConfig -from google.adk.telemetry import ContentCapturingMode, TelemetryConfig +To record complete interaction data as human-readable YAML appended to `adk_debug.yaml` rather than truncated console output, use `DebugLoggingPlugin`: -run_config = RunConfig( - telemetry=TelemetryConfig( - capture_message_content=ContentCapturingMode.SPAN_AND_EVENT, - ), -) -``` +=== "Python" -#### OTLP export + ```python + from google.adk.apps import App + from google.adk.plugins import DebugLoggingPlugin -To export logs to an OpenTelemetry Collector (or an OTLP-compatible backend) -programmatically: + app = App( + name="my_app", + root_agent=root_agent, + plugins=[ + DebugLoggingPlugin( + output_path="adk_debug.yaml", + include_session_state=True, + include_system_instruction=True, + ), + ], + ) + ``` -```python -from google.adk.telemetry.setup import maybe_set_otel_providers -import os +=== "Kotlin" -os.environ["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] = "http://your-collector:4318/v1/logs" -os.environ["OTEL_SERVICE_NAME"] = "your-adk-agent" -os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "key1=value1,key2=value2" -maybe_set_otel_providers() -``` + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:debug_logging_plugin" + ``` -#### GCP export setup +!!! warning + The output file holds raw prompts, tool arguments, and session state. Although credentials and `temp:`-scoped state keys are automatically redacted in Python, treat the output file as sensitive. -To export logs to Google Cloud Logging programmatically, use the OpenTelemetry -Google Cloud exporter. Here is an example in Python: +### Programmatic setup -```python -from google.adk.telemetry.google_cloud import get_gcp_exporters -from google.adk.telemetry.setup import maybe_set_otel_providers -import os +While plugins help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: -gcp_exporters = get_gcp_exporters( - enable_cloud_logging = True, -) -os.environ["OTEL_SERVICE_NAME"] = "your-adk-agent" -os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "key1=value1,key2=value2" -maybe_set_otel_providers([gcp_exporters]) -``` +- **Python:** Uses the standard `logging` module and OpenTelemetry for structured GenAI logs. +- **Kotlin:** Uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. +- **Go:** Uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration and the standard `log` package for general events (written to `stderr` by default). -### Kotlin programmatic setup +#### Logging level -In Kotlin, ADK uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. +=== "Python" + + To enable detailed logging, including `DEBUG` level messages, add the following + to the top of your script: + + ```python + import logging + + logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s - %(levelname)s - %(name)s - %(message)s' + ) + ``` + +=== "Kotlin" + + ADK uses standard JVM logging facilities (defaulting to Flogger). Configure your JVM logger backend (e.g., `java.util.logging` or SLF4J) to adjust log verbosity. + +=== "Go" + + General events (such as server startup or HTTP requests) are logged using the standard Go `log` package and written to `stderr` by default. #### Capture prompt content -You can enable full prompt logging by configuring the global `TelemetryConfig`: +=== "Python" -```kotlin ---8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:capture_content" -``` + You can enable full prompt logging programmatically by setting an environment + variable: -#### Activity logging with Plugins + ```python + import os -To get detailed logs of agent activity (user messages, model requests/responses, tool calls) in the console, use the `LoggingPlugin`: + os.environ["OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT"] = "true" + ``` -```kotlin ---8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" -``` + To scope content capture to a single run instead of the whole process, set + `RunConfig.telemetry` rather than the environment variable: -#### Full debug capture to a file + ```python + from google.adk.agents.run_config import RunConfig + from google.adk.telemetry import ContentCapturingMode, TelemetryConfig -
- Supported in ADKKotlin v0.6.0 -
+ run_config = RunConfig( + telemetry=TelemetryConfig( + capture_message_content=ContentCapturingMode.SPAN_AND_EVENT, + ), + ) + ``` -To record the same activity in full, as YAML appended to `adk_debug.yaml` rather than truncated console output, use the `DebugLoggingPlugin`: +=== "Kotlin" -```kotlin ---8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:debug_logging_plugin" -``` + You can enable full prompt logging by configuring the global `TelemetryConfig`: -!!! warning - The output file holds raw prompts, tool arguments and session state. Treat it as sensitive. + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:capture_content" + ``` -### Go programmatic setup +=== "Go" -In Go, ADK uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry -configuration and the standard `log` package for general events. + You can enable full prompt logging programmatically when initializing telemetry: -#### Capture prompt content + ```go + package main -You can enable full prompt logging programmatically when initializing telemetry: - -```go -package main - -import ( - "context" - "google.golang.org/adk/v2/telemetry" -) - -func main() { - ctx := context.Background() - tp, err := telemetry.New(ctx, - telemetry.WithGenAICaptureMessageContent(true), - ) - if err != nil { - // handle error - } - defer tp.Shutdown(ctx) - tp.SetGlobalOtelProviders() -} -``` + import ( + "context" + "google.golang.org/adk/v2/telemetry" + ) + + func main() { + ctx := context.Background() + tp, err := telemetry.New(ctx, + telemetry.WithGenAICaptureMessageContent(true), + ) + if err != nil { + // handle error + } + defer tp.Shutdown(ctx) + tp.SetGlobalOtelProviders() + } + ``` #### OTLP export -To export logs to an OTLP-compatible backend, configure the standard -OpenTelemetry environment variables (e.g., `OTEL_EXPORTER_OTLP_ENDPOINT` or -`OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`). The ADK telemetry package will -automatically use these settings when initialized. +=== "Python" + + To export logs to an OpenTelemetry Collector (or an OTLP-compatible backend) + programmatically: + + ```python + from google.adk.telemetry.setup import maybe_set_otel_providers + import os + + os.environ["OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"] = "http://your-collector:4318/v1/logs" + os.environ["OTEL_SERVICE_NAME"] = "your-adk-agent" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "key1=value1,key2=value2" + maybe_set_otel_providers() + ``` + +=== "Kotlin" + + ADK automatically uses the `GlobalOpenTelemetry` instance on the JVM. Configure your OpenTelemetry SDK exporter before starting the agent: + + ```kotlin + --8<-- "examples/kotlin/snippets/observability/SetupExample.kt:full_example" + ``` + +=== "Go" + + To export logs to an OTLP-compatible backend, configure the standard + OpenTelemetry environment variables (e.g., `OTEL_EXPORTER_OTLP_ENDPOINT` or + `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`). The ADK telemetry package will + automatically use these settings when initialized. #### GCP export setup -To export logs to Google Cloud Logging, use the `WithOtelToCloud` option: - -```go -package main - -import ( - "context" - "google.golang.org/adk/v2/telemetry" -) - -func main() { - ctx := context.Background() - tp, err := telemetry.New(ctx, - telemetry.WithOtelToCloud(true), - ) - if err != nil { - // handle error - } - defer tp.Shutdown(ctx) - tp.SetGlobalOtelProviders() -} -``` +=== "Python" -If using the Go launcher, you can also enable GCP export via the CLI flag: + To export logs to Google Cloud Logging programmatically, use the OpenTelemetry + Google Cloud exporter. Here is an example in Python: -```bash -go run main.go web -otel_to_cloud -``` + ```python + from google.adk.telemetry.google_cloud import get_gcp_exporters + from google.adk.telemetry.setup import maybe_set_otel_providers + import os + + gcp_exporters = get_gcp_exporters( + enable_cloud_logging = True, + ) + os.environ["OTEL_SERVICE_NAME"] = "your-adk-agent" + os.environ["OTEL_RESOURCE_ATTRIBUTES"] = "key1=value1,key2=value2" + maybe_set_otel_providers([gcp_exporters]) + ``` + +=== "Kotlin" + + ADK Kotlin does not provide a built-in GCP exporter wrapper. Because it uses the standard `GlobalOpenTelemetry` instance on the JVM, you can export to Google Cloud by configuring your `OpenTelemetrySdk` with the [Google Cloud OpenTelemetry Java exporters](https://github.com/GoogleCloudPlatform/opentelemetry-operations-java) or an OTLP exporter targeting the Google Cloud Telemetry endpoint before starting your agent. + +=== "Go" + + To export logs to Google Cloud Logging, use the `WithOtelToCloud` option: + + ```go + package main + + import ( + "context" + "google.golang.org/adk/v2/telemetry" + ) + + func main() { + ctx := context.Background() + tp, err := telemetry.New(ctx, + telemetry.WithOtelToCloud(true), + ) + if err != nil { + // handle error + } + defer tp.Shutdown(ctx) + tp.SetGlobalOtelProviders() + } + ``` + + If using the Go launcher, you can also enable GCP export via the CLI flag: -General events (like server startup or HTTP requests) are logged using the -standard Go `log` package. These logs are written to `stderr` by default. + ```bash + go run main.go web -otel_to_cloud + ``` ## Understanding log output From 03572a8105ae49611ce4c4774f053939ab5a17ea Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Mon, 7 Sep 2026 19:46:45 +0000 Subject: [PATCH 02/26] fixed deprecated process --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index e84e58e9e5..ff358ff527 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -329,7 +329,7 @@ While plugins help inspect individual agent runs during local development, progr === "Kotlin" - ADK Kotlin does not provide a built-in GCP exporter wrapper. Because it uses the standard `GlobalOpenTelemetry` instance on the JVM, you can export to Google Cloud by configuring your `OpenTelemetrySdk` with the [Google Cloud OpenTelemetry Java exporters](https://github.com/GoogleCloudPlatform/opentelemetry-operations-java) or an OTLP exporter targeting the Google Cloud Telemetry endpoint before starting your agent. + ADK Kotlin does not provide a built-in GCP exporter wrapper. Because it uses the standard `GlobalOpenTelemetry` instance on the JVM, you can export to Google Cloud by configuring your `OpenTelemetrySdk` with a standard OTLP exporter targeting the Google Cloud Telemetry endpoint before starting your agent. === "Go" From d26ca29082339ae821f1423c788899139012d5d4 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Thu, 10 Sep 2026 23:08:47 +0000 Subject: [PATCH 03/26] organization quick fixes --- docs/observability/logging.md | 175 +++++++++++++++++++--------------- 1 file changed, 98 insertions(+), 77 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index ff358ff527..52d7c31509 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -35,8 +35,7 @@ for GenAI](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-events.md). By default prompt content is elided in logs for security. You can enable prompt -logging using environment variables or programmatic configuration (see Setup -section below). +logging using environment variables or programmatic configuration (see [Capture prompt content](#capture-prompt-content) below). ### Log levels (Python) @@ -55,15 +54,13 @@ using the standard logger: Only enable `DEBUG` when actively troubleshooting an issue, as `DEBUG` logs can be very verbose and may contain sensitive information. -## Logging setup - -### Logging in ADK Web +## Logging in ADK Web When running agents using the ADK's `adk web`, `adk api_server`, `adk deploy cloud_run` and `adk deploy gke` commands, you can control the log verbosity or destination. -#### Logging level +### Logging level To start the web server with `DEBUG` level logging, run: @@ -74,7 +71,7 @@ adk web --log_level DEBUG path/to/your/agents_dir The available log levels for the `--log_level` option are: `DEBUG`, `INFO` (default), `WARNING`, `ERROR`, `CRITICAL`. -#### Capture prompt content +### Capture prompt content By default a prompt content is elided in logs for security. You can enable prompt logging using the environment variable: @@ -96,7 +93,7 @@ and `SPAN_AND_EVENT` also require debugging but may capture sensitive data or PII. In production, set this to false or ensure you have appropriate data handling policies in place. -#### OTLP export +### OTLP export To export logs to an OTLP-compatible backend, set the standard OTel environment variables: @@ -112,7 +109,7 @@ adk web path/to/your/agents_dir in addition to logs. -#### GCP export setup +### GCP export setup You can enable GCP export using the `--otel_to_cloud` flag: @@ -120,70 +117,7 @@ You can enable GCP export using the `--otel_to_cloud` flag: adk web --otel_to_cloud path/to/your/agents_dir ``` -### Activity logging with plugins - -ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and session state) without modifying your agent logic. - -#### Console logging with `LoggingPlugin` - -To print structured activity logs to the console during execution, attach `LoggingPlugin` to your `App`: - -=== "Python" - - ```python - from google.adk.apps import App - from google.adk.plugins import LoggingPlugin - - app = App( - name="my_app", - root_agent=root_agent, - plugins=[LoggingPlugin()], - ) - ``` - -=== "Kotlin" - - ```kotlin - --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" - ``` - -#### Full debug capture to a file with `DebugLoggingPlugin` - -
- Supported in ADKPython v1.23.0Kotlin v0.6.0 -
- -To record complete interaction data as human-readable YAML appended to `adk_debug.yaml` rather than truncated console output, use `DebugLoggingPlugin`: - -=== "Python" - - ```python - from google.adk.apps import App - from google.adk.plugins import DebugLoggingPlugin - - app = App( - name="my_app", - root_agent=root_agent, - plugins=[ - DebugLoggingPlugin( - output_path="adk_debug.yaml", - include_session_state=True, - include_system_instruction=True, - ), - ], - ) - ``` - -=== "Kotlin" - - ```kotlin - --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:debug_logging_plugin" - ``` - -!!! warning - The output file holds raw prompts, tool arguments, and session state. Although credentials and `temp:`-scoped state keys are automatically redacted in Python, treat the output file as sensitive. - -### Programmatic setup +## Programmatic setup While plugins help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: @@ -191,7 +125,7 @@ While plugins help inspect individual agent runs during local development, progr - **Kotlin:** Uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. - **Go:** Uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration and the standard `log` package for general events (written to `stderr` by default). -#### Logging level +### Logging level === "Python" @@ -215,7 +149,7 @@ While plugins help inspect individual agent runs during local development, progr General events (such as server startup or HTTP requests) are logged using the standard Go `log` package and written to `stderr` by default. -#### Capture prompt content +### Capture prompt content === "Python" @@ -275,7 +209,7 @@ While plugins help inspect individual agent runs during local development, progr } ``` -#### OTLP export +### OTLP export === "Python" @@ -307,7 +241,7 @@ While plugins help inspect individual agent runs during local development, progr `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`). The ADK telemetry package will automatically use these settings when initialized. -#### GCP export setup +### GCP export setup === "Python" @@ -362,6 +296,93 @@ While plugins help inspect individual agent runs during local development, progr go run main.go web -otel_to_cloud ``` +## Activity logging with plugins + +ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and session state) without modifying your agent logic. + +### Console logging with `LoggingPlugin` + +To print structured activity logs to the console during execution, attach `LoggingPlugin` to your `App` (or configure `loggingplugin` in Go): + +=== "Python" + + ```python + from google.adk.apps import App + from google.adk.plugins import LoggingPlugin + + app = App( + name="my_app", + root_agent=root_agent, + plugins=[LoggingPlugin()], + ) + ``` + +=== "Kotlin" + + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" + ``` + +=== "Go" + + ```go + import ( + "google.golang.org/adk/v2/agent" + "google.golang.org/adk/v2/cmd/launcher" + "google.golang.org/adk/v2/plugin" + "google.golang.org/adk/v2/plugin/loggingplugin" + "google.golang.org/adk/v2/runner" + ) + + logPlugin, err := loggingplugin.New("logging_plugin") + if err != nil { + // handle error + } + + config := &launcher.Config{ + AgentLoader: agent.NewSingleLoader(rootAgent), + PluginConfig: runner.PluginConfig{ + Plugins: []*plugin.Plugin{logPlugin}, + }, + } + ``` + +### Full debug capture to a file with `DebugLoggingPlugin` + +
+ Supported in ADKPython v1.23.0Kotlin v0.6.0 +
+ +To record complete interaction data as human-readable YAML appended to `adk_debug.yaml` rather than truncated console output, use `DebugLoggingPlugin`: + +=== "Python" + + ```python + from google.adk.apps import App + from google.adk.plugins import DebugLoggingPlugin + + app = App( + name="my_app", + root_agent=root_agent, + plugins=[ + DebugLoggingPlugin( + output_path="adk_debug.yaml", + include_session_state=True, + include_system_instruction=True, + ), + ], + ) + ``` + +=== "Kotlin" + + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:debug_logging_plugin" + ``` + +!!! warning + The output file holds raw prompts, tool arguments, and session state. Although credentials and `temp:`-scoped state keys are automatically redacted in Python, treat the output file as sensitive. + ## Understanding log output ### Sample Python log entry From 6a713b13e505e54f7459b0a2e30a2d6376f5dfbd Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:25:44 -0600 Subject: [PATCH 04/26] Update docs/observability/logging.md Adding nuance to comment Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 52d7c31509..28367531b1 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -228,7 +228,7 @@ While plugins help inspect individual agent runs during local development, progr === "Kotlin" - ADK automatically uses the `GlobalOpenTelemetry` instance on the JVM. Configure your OpenTelemetry SDK exporter before starting the agent: + ADK automatically uses the `GlobalOpenTelemetry` instance on the JVM. Configure your OpenTelemetry SDK exporter before starting the agent. The example below wires up a **trace** pipeline only; to export log records, also register an `SdkLoggerProvider` with a log-record exporter. ```kotlin --8<-- "examples/kotlin/snippets/observability/SetupExample.kt:full_example" From e535ec37f5e065cedc9c608f181119dc339a7953 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:27:21 -0600 Subject: [PATCH 05/26] Update docs/observability/logging.md Warning note for snippet Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 28367531b1..99257d0f32 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -234,6 +234,11 @@ While plugins help inspect individual agent runs during local development, progr --8<-- "examples/kotlin/snippets/observability/SetupExample.kt:full_example" ``` + !!! warning + This example sets `TelemetryConfig.captureMessageContent = true`, which records full + prompt and response content. Leave it disabled in production unless you have + appropriate data handling policies in place. + === "Go" To export logs to an OTLP-compatible backend, configure the standard From 53ec2d264b3c1b7e65171de94b3a61561c309733 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:34:17 -0600 Subject: [PATCH 06/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 99257d0f32..e931d0806e 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -60,7 +60,7 @@ When running agents using the ADK's `adk web`, `adk api_server`, `adk deploy cloud_run` and `adk deploy gke` commands, you can control the log verbosity or destination. -### Logging level +### Logging level in ADK Web To start the web server with `DEBUG` level logging, run: From aace7151749696ce282be99f0326ef903405f759 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:35:15 -0600 Subject: [PATCH 07/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index e931d0806e..31ed5c5667 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -71,7 +71,7 @@ adk web --log_level DEBUG path/to/your/agents_dir The available log levels for the `--log_level` option are: `DEBUG`, `INFO` (default), `WARNING`, `ERROR`, `CRITICAL`. -### Capture prompt content +### Capture prompt content in ADK Web By default a prompt content is elided in logs for security. You can enable prompt logging using the environment variable: From 5679992c721d0fe7c42e2283bfaa7d3fa0fa0422 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:35:54 -0600 Subject: [PATCH 08/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 31ed5c5667..fcc9cb78a9 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -119,7 +119,7 @@ adk web --otel_to_cloud path/to/your/agents_dir ## Programmatic setup -While plugins help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: +While the [plugins](#activity-logging-with-plugins) described later on this page help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: - **Python:** Uses the standard `logging` module and OpenTelemetry for structured GenAI logs. - **Kotlin:** Uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. From df5efcfe5869fc7c837136c25b76e3ab722fb017 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 18:44:41 +0000 Subject: [PATCH 09/26] updated snippet --- docs/observability/logging.md | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index fcc9cb78a9..caccb598de 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -186,21 +186,25 @@ While the [plugins](#activity-logging-with-plugins) described later on this page === "Go" - You can enable full prompt logging programmatically when initializing telemetry: + You can enable full prompt logging when initializing telemetry by exporting `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`: ```go package main import ( "context" + "os" + "google.golang.org/adk/v2/telemetry" ) func main() { ctx := context.Background() - tp, err := telemetry.New(ctx, - telemetry.WithGenAICaptureMessageContent(true), - ) + + // Enable GenAI message content capture via the OpenTelemetry environment variable + os.Setenv("OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT", "true") + + tp, err := telemetry.New(ctx) if err != nil { // handle error } From 695043583a459a1a7d385648c0cbeda808b68e30 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 18:52:36 +0000 Subject: [PATCH 10/26] added comment about traces-only for Kotlin --- docs/observability/logging.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index caccb598de..293578e642 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -232,7 +232,10 @@ While the [plugins](#activity-logging-with-plugins) described later on this page === "Kotlin" - ADK automatically uses the `GlobalOpenTelemetry` instance on the JVM. Configure your OpenTelemetry SDK exporter before starting the agent. The example below wires up a **trace** pipeline only; to export log records, also register an `SdkLoggerProvider` with a log-record exporter. + ADK Kotlin's OpenTelemetry integration emits **traces only** — it registers no + `LoggerProvider`, so there is no OTLP log export. Application logs go to your JVM + logging backend. To export ADK traces, configure the OpenTelemetry SDK before + starting the agent: ```kotlin --8<-- "examples/kotlin/snippets/observability/SetupExample.kt:full_example" From 8003c0d9adb0d29a1e5cd9822bb0eb248d5988ca Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:56:48 -0600 Subject: [PATCH 11/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 293578e642..9690261b87 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -275,7 +275,11 @@ While the [plugins](#activity-logging-with-plugins) described later on this page === "Kotlin" - ADK Kotlin does not provide a built-in GCP exporter wrapper. Because it uses the standard `GlobalOpenTelemetry` instance on the JVM, you can export to Google Cloud by configuring your `OpenTelemetrySdk` with a standard OTLP exporter targeting the Google Cloud Telemetry endpoint before starting your agent. + ADK Kotlin emits no OpenTelemetry log records, so there is nothing for Cloud Logging + to receive; application logs go to your JVM logging backend. ADK Kotlin **traces** can + be sent to Google Cloud by pointing a standard OTLP exporter at `telemetry.googleapis.com` + — see [OTLP with Google Cloud](https://cloud.google.com/stackdriver/docs/otlp/overview) + for the required credentials, quota project and `roles/telemetry.writer` grant. === "Go" From 396683c309beb824ec7446c58a3aac54c2add938 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 12:58:11 -0600 Subject: [PATCH 12/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 9690261b87..636433f15a 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -314,7 +314,7 @@ While the [plugins](#activity-logging-with-plugins) described later on this page ## Activity logging with plugins -ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and session state) without modifying your agent logic. +ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and — with `DebugLoggingPlugin` — session state) without modifying your agent logic. ### Console logging with `LoggingPlugin` From f3c9818569042e0188ff05a7ecb84db7f7447594 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 19:03:15 +0000 Subject: [PATCH 13/26] fixed Go snippet --- docs/observability/logging.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 636433f15a..31ab5ba6f2 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -342,24 +342,36 @@ To print structured activity logs to the console during execution, attach `Loggi === "Go" ```go + package main + import ( + "context" + "log" + "os" + "google.golang.org/adk/v2/agent" "google.golang.org/adk/v2/cmd/launcher" + "google.golang.org/adk/v2/cmd/launcher/full" "google.golang.org/adk/v2/plugin" "google.golang.org/adk/v2/plugin/loggingplugin" "google.golang.org/adk/v2/runner" ) - logPlugin, err := loggingplugin.New("logging_plugin") - if err != nil { - // handle error - } + func main() { + ctx := context.Background() + logPlugin := loggingplugin.MustNew("logging_plugin") - config := &launcher.Config{ - AgentLoader: agent.NewSingleLoader(rootAgent), - PluginConfig: runner.PluginConfig{ - Plugins: []*plugin.Plugin{logPlugin}, - }, + config := &launcher.Config{ + AgentLoader: agent.NewSingleLoader(rootAgent), + PluginConfig: runner.PluginConfig{ + Plugins: []*plugin.Plugin{logPlugin}, + }, + } + + l := full.NewLauncher() + if err := l.Execute(ctx, config, os.Args[1:]); err != nil { + log.Fatalf("run failed: %v", err) + } } ``` From c65077371ca9ad343f15fa2ab8e62d0a44a64c6c Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:06:26 -0600 Subject: [PATCH 14/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 31ab5ba6f2..c0edc0721f 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -35,7 +35,10 @@ for GenAI](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-events.md). By default prompt content is elided in logs for security. You can enable prompt -logging using environment variables or programmatic configuration (see [Capture prompt content](#capture-prompt-content) below). +logging using environment variables or programmatic configuration. See +[Capture prompt content](#capture-prompt-content) for `adk web`, and +[Capture prompt content programmatically](#capture-prompt-content-programmatically) +for setup in code. ### Log levels (Python) From 7c1954f2edaa3433fae266114d634c299a00fc9d Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:07:17 -0600 Subject: [PATCH 15/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index c0edc0721f..4c6e1a43e3 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -124,7 +124,8 @@ adk web --otel_to_cloud path/to/your/agents_dir While the [plugins](#activity-logging-with-plugins) described later on this page help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: -- **Python:** Uses the standard `logging` module and OpenTelemetry for structured GenAI logs. +- **Python:** ADK uses the standard `logging` module and OpenTelemetry for + structured GenAI logs. - **Kotlin:** Uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. - **Go:** Uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration and the standard `log` package for general events (written to `stderr` by default). From 2f9ab3cecefb32e21bb5d14a6f1b8274fc28bfa3 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:08:07 -0600 Subject: [PATCH 16/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 4c6e1a43e3..a876370d2b 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -413,7 +413,9 @@ To record complete interaction data as human-readable YAML appended to `adk_debu ``` !!! warning - The output file holds raw prompts, tool arguments, and session state. Although credentials and `temp:`-scoped state keys are automatically redacted in Python, treat the output file as sensitive. + The output file holds raw prompts, tool arguments, and session state. + Although ADK automatically redacts credentials and `temp:`-scoped state + keys in Python, treat the output file as sensitive. ## Understanding log output From adf7894f057912389da3ffa75e67df5405c4c02e Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:09:04 -0600 Subject: [PATCH 17/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index a876370d2b..21a76b44ae 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -385,7 +385,9 @@ To print structured activity logs to the console during execution, attach `Loggi Supported in ADKPython v1.23.0Kotlin v0.6.0 -To record complete interaction data as human-readable YAML appended to `adk_debug.yaml` rather than truncated console output, use `DebugLoggingPlugin`: +To record complete interaction data as human-readable YAML appended to +`adk_debug.yaml` rather than truncated console output, use +`DebugLoggingPlugin`: === "Python" From 5d6e9ef336f01e72a861972ea755b0349be1c61c Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:09:33 -0600 Subject: [PATCH 18/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 21a76b44ae..8826dd6bdd 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -126,7 +126,8 @@ While the [plugins](#activity-logging-with-plugins) described later on this page - **Python:** ADK uses the standard `logging` module and OpenTelemetry for structured GenAI logs. -- **Kotlin:** Uses standard JVM logging facilities (defaulting to Flogger) and OpenTelemetry for structured GenAI logs. +- **Kotlin:** ADK uses standard JVM logging facilities, defaulting to Flogger, + and OpenTelemetry for structured GenAI logs. - **Go:** Uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration and the standard `log` package for general events (written to `stderr` by default). ### Logging level From 9475d47e05fff95fe7daa9ef72596beffd717b0a Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:10:12 -0600 Subject: [PATCH 19/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 8826dd6bdd..c63e176d38 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -323,7 +323,8 @@ ADK provides built-in plugins to capture agent activity (user messages, model re ### Console logging with `LoggingPlugin` -To print structured activity logs to the console during execution, attach `LoggingPlugin` to your `App` (or configure `loggingplugin` in Go): +To print structured activity logs to the console during execution, attach +`LoggingPlugin` to your `App`: === "Python" From 2789996516a08c7a481711bbbfb633b5582277c1 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Tue, 15 Sep 2026 13:10:58 -0600 Subject: [PATCH 20/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index c63e176d38..f55659ccb0 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -128,7 +128,9 @@ While the [plugins](#activity-logging-with-plugins) described later on this page structured GenAI logs. - **Kotlin:** ADK uses standard JVM logging facilities, defaulting to Flogger, and OpenTelemetry for structured GenAI logs. -- **Go:** Uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration and the standard `log` package for general events (written to `stderr` by default). +- **Go:** ADK uses the `google.golang.org/adk/v2/telemetry` package for + OpenTelemetry configuration, and the standard `log` package for general + events, which it writes to `stderr` by default. ### Logging level From fe4ec93387fdd32ae9f6f758108803a470b6fc4b Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 20:34:26 +0000 Subject: [PATCH 21/26] final writing structure changes --- docs/observability/logging.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index f55659ccb0..ac583fc367 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -122,7 +122,9 @@ adk web --otel_to_cloud path/to/your/agents_dir ## Programmatic setup -While the [plugins](#activity-logging-with-plugins) described later on this page help inspect individual agent runs during local development, programmatic setup configures the underlying logging framework and OpenTelemetry exporters for system-level diagnostics and production observability: +Programmatic setup configures the underlying logging framework and +OpenTelemetry exporters from your own code, for system-level diagnostics and +production observability. ADK uses the following logging facilities: - **Python:** ADK uses the standard `logging` module and OpenTelemetry for structured GenAI logs. @@ -321,7 +323,10 @@ While the [plugins](#activity-logging-with-plugins) described later on this page ## Activity logging with plugins -ADK provides built-in plugins to capture agent activity (user messages, model requests/responses, tool calls, and — with `DebugLoggingPlugin` — session state) without modifying your agent logic. +ADK provides built-in plugins that capture agent activity, including user +messages, model requests and responses, tool calls, and (with +`DebugLoggingPlugin`) session state. These plugins require no changes to your +agent logic. ### Console logging with `LoggingPlugin` From 489b1e15538bd785e77a21477a6abb3ea4061ab8 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 21:16:25 +0000 Subject: [PATCH 22/26] final changes --- docs/observability/logging.md | 79 ++++++++++++++++------------------- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index ac583fc367..eb617b71b3 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -96,7 +96,7 @@ and `SPAN_AND_EVENT` also require debugging but may capture sensitive data or PII. In production, set this to false or ensure you have appropriate data handling policies in place. -### OTLP export +### OTLP export in ADK Web To export logs to an OTLP-compatible backend, set the standard OTel environment variables: @@ -112,7 +112,7 @@ adk web path/to/your/agents_dir in addition to logs. -### GCP export setup +### GCP export setup in ADK Web You can enable GCP export using the `--otel_to_cloud` flag: @@ -150,14 +150,14 @@ production observability. ADK uses the following logging facilities: ) ``` -=== "Kotlin" - - ADK uses standard JVM logging facilities (defaulting to Flogger). Configure your JVM logger backend (e.g., `java.util.logging` or SLF4J) to adjust log verbosity. - === "Go" General events (such as server startup or HTTP requests) are logged using the standard Go `log` package and written to `stderr` by default. +=== "Kotlin" + + ADK uses standard JVM logging facilities (defaulting to Flogger). Configure your JVM logger backend (e.g., `java.util.logging` or SLF4J) to adjust log verbosity. + ### Capture prompt content === "Python" @@ -185,14 +185,6 @@ production observability. ADK uses the following logging facilities: ) ``` -=== "Kotlin" - - You can enable full prompt logging by configuring the global `TelemetryConfig`: - - ```kotlin - --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:capture_content" - ``` - === "Go" You can enable full prompt logging when initializing telemetry by exporting `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true`: @@ -222,6 +214,14 @@ production observability. ADK uses the following logging facilities: } ``` +=== "Kotlin" + + You can enable full prompt logging by configuring the global `TelemetryConfig`: + + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:capture_content" + ``` + ### OTLP export === "Python" @@ -239,22 +239,6 @@ production observability. ADK uses the following logging facilities: maybe_set_otel_providers() ``` -=== "Kotlin" - - ADK Kotlin's OpenTelemetry integration emits **traces only** — it registers no - `LoggerProvider`, so there is no OTLP log export. Application logs go to your JVM - logging backend. To export ADK traces, configure the OpenTelemetry SDK before - starting the agent: - - ```kotlin - --8<-- "examples/kotlin/snippets/observability/SetupExample.kt:full_example" - ``` - - !!! warning - This example sets `TelemetryConfig.captureMessageContent = true`, which records full - prompt and response content. Leave it disabled in production unless you have - appropriate data handling policies in place. - === "Go" To export logs to an OTLP-compatible backend, configure the standard @@ -262,6 +246,13 @@ production observability. ADK uses the following logging facilities: `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`). The ADK telemetry package will automatically use these settings when initialized. +=== "Kotlin" + + ADK Kotlin's OpenTelemetry integration emits **traces only** — it registers no + `LoggerProvider`, so there is no OTLP log export. Application logs go to your JVM + logging backend. To configure trace export, see the [Traces](traces.md) + documentation. + ### GCP export setup === "Python" @@ -282,14 +273,6 @@ production observability. ADK uses the following logging facilities: maybe_set_otel_providers([gcp_exporters]) ``` -=== "Kotlin" - - ADK Kotlin emits no OpenTelemetry log records, so there is nothing for Cloud Logging - to receive; application logs go to your JVM logging backend. ADK Kotlin **traces** can - be sent to Google Cloud by pointing a standard OTLP exporter at `telemetry.googleapis.com` - — see [OTLP with Google Cloud](https://cloud.google.com/stackdriver/docs/otlp/overview) - for the required credentials, quota project and `roles/telemetry.writer` grant. - === "Go" To export logs to Google Cloud Logging, use the `WithOtelToCloud` option: @@ -321,6 +304,14 @@ production observability. ADK uses the following logging facilities: go run main.go web -otel_to_cloud ``` +=== "Kotlin" + + ADK Kotlin emits no OpenTelemetry log records, so there is nothing for Cloud Logging + to receive; application logs go to your JVM logging backend. ADK Kotlin **traces** can + be sent to Google Cloud by pointing a standard OTLP exporter at `telemetry.googleapis.com` + — see [OTLP with Google Cloud](https://cloud.google.com/stackdriver/docs/otlp/overview) + for the required credentials, quota project and `roles/telemetry.writer` grant. + ## Activity logging with plugins ADK provides built-in plugins that capture agent activity, including user @@ -346,12 +337,6 @@ To print structured activity logs to the console during execution, attach ) ``` -=== "Kotlin" - - ```kotlin - --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" - ``` - === "Go" ```go @@ -388,6 +373,12 @@ To print structured activity logs to the console during execution, attach } ``` +=== "Kotlin" + + ```kotlin + --8<-- "examples/kotlin/snippets/observability/LoggingExamples.kt:logging_plugin" + ``` + ### Full debug capture to a file with `DebugLoggingPlugin`
From 5c2955933de2d760ce537fe7436d7f8eadfe2bfd Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Tue, 15 Sep 2026 21:53:44 +0000 Subject: [PATCH 23/26] fixed link --- docs/observability/logging.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index eb617b71b3..5f598d29ae 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -36,8 +36,8 @@ GenAI](https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen By default prompt content is elided in logs for security. You can enable prompt logging using environment variables or programmatic configuration. See -[Capture prompt content](#capture-prompt-content) for `adk web`, and -[Capture prompt content programmatically](#capture-prompt-content-programmatically) +[Capture prompt content](#capture-prompt-content-in-adk-web) for `adk web`, and +[Capture prompt content programmatically](#capture-prompt-content) for setup in code. ### Log levels (Python) @@ -128,11 +128,11 @@ production observability. ADK uses the following logging facilities: - **Python:** ADK uses the standard `logging` module and OpenTelemetry for structured GenAI logs. -- **Kotlin:** ADK uses standard JVM logging facilities, defaulting to Flogger, - and OpenTelemetry for structured GenAI logs. - **Go:** ADK uses the `google.golang.org/adk/v2/telemetry` package for OpenTelemetry configuration, and the standard `log` package for general events, which it writes to `stderr` by default. +- **Kotlin:** ADK uses standard JVM logging facilities, defaulting to Flogger, + and OpenTelemetry for structured GenAI logs. ### Logging level From f3ee920c10f688b61c51556336434ce2e71be64d Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Mon, 21 Sep 2026 14:02:26 -0600 Subject: [PATCH 24/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 5f598d29ae..8bac9a89ab 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -156,7 +156,7 @@ production observability. ADK uses the following logging facilities: === "Kotlin" - ADK uses standard JVM logging facilities (defaulting to Flogger). Configure your JVM logger backend (e.g., `java.util.logging` or SLF4J) to adjust log verbosity. + ADK uses standard JVM logging facilities (defaulting to Flogger). Configure your JVM logger backend, such as `java.util.logging` or SLF4J, to adjust log verbosity. ### Capture prompt content From 0611556605730f6d82a012bfa4764f21f3572180 Mon Sep 17 00:00:00 2001 From: JuanCa <41661695+JuanCaCoder@users.noreply.github.com> Date: Mon, 21 Sep 2026 14:02:41 -0600 Subject: [PATCH 25/26] Update docs/observability/logging.md Co-authored-by: Joe Fernandez <931947+joefernandez@users.noreply.github.com> --- docs/observability/logging.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index 8bac9a89ab..a56c0b76a6 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -136,6 +136,8 @@ production observability. ADK uses the following logging facilities: ### Logging level +You can set the logging level for your ADK agent using standard logging controls, as follows: + === "Python" To enable detailed logging, including `DEBUG` level messages, add the following From 2c4b4f665aae7363445f21cd1e879d72dc8d1324 Mon Sep 17 00:00:00 2001 From: Juan Carlos Radillo Diaz Date: Mon, 21 Sep 2026 20:12:33 +0000 Subject: [PATCH 26/26] joes last comment about this update --- docs/observability/logging.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/observability/logging.md b/docs/observability/logging.md index a56c0b76a6..3ea06d598a 100644 --- a/docs/observability/logging.md +++ b/docs/observability/logging.md @@ -244,9 +244,9 @@ You can set the logging level for your ADK agent using standard logging controls === "Go" To export logs to an OTLP-compatible backend, configure the standard - OpenTelemetry environment variables (e.g., `OTEL_EXPORTER_OTLP_ENDPOINT` or - `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`). The ADK telemetry package will - automatically use these settings when initialized. + OpenTelemetry environment variables, such as `OTEL_EXPORTER_OTLP_ENDPOINT` + or `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT`. The ADK telemetry package uses these + settings automatically when initialized. === "Kotlin"