From 82a2bfa1cab4b6bcbeb6430a1cc0aeeac71dea7a Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Thu, 8 Oct 2026 22:08:15 +0530 Subject: [PATCH] fix(a2a): stop to_a2a from overriding the application's log level to_a2a() set the "google_adk" logger to INFO on every call, so a level the application configured before building the app (for example with `uvicorn --log-config`) was silently replaced: DEBUG logs disappeared and a WARNING setting started letting INFO through. The override did not make logs visible under plain uvicorn either: uvicorn's default config adds no root handler, so ADK INFO records were dropped with or without it. Leave the level to the application. Fixes #7462 --- src/google/adk/a2a/utils/agent_to_a2a.py | 2 -- tests/unittests/a2a/utils/test_agent_to_a2a.py | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/google/adk/a2a/utils/agent_to_a2a.py b/src/google/adk/a2a/utils/agent_to_a2a.py index 3e49bf7fda..4bfed2ad51 100644 --- a/src/google/adk/a2a/utils/agent_to_a2a.py +++ b/src/google/adk/a2a/utils/agent_to_a2a.py @@ -178,9 +178,7 @@ async def lifespan(app): app = to_a2a(agent, task_store=task_store, lifespan=lifespan) """ - # Set up ADK logging to ensure logs are visible when using uvicorn directly adk_logger = logging.getLogger("google_adk") - adk_logger.setLevel(logging.INFO) def create_runner() -> Runner: """Create a runner for the agent or workflow.""" diff --git a/tests/unittests/a2a/utils/test_agent_to_a2a.py b/tests/unittests/a2a/utils/test_agent_to_a2a.py index 3456834871..c9dda6af6c 100644 --- a/tests/unittests/a2a/utils/test_agent_to_a2a.py +++ b/tests/unittests/a2a/utils/test_agent_to_a2a.py @@ -656,6 +656,13 @@ def test_to_a2a_returns_starlette_app( assert result == mock_app + def test_to_a2a_keeps_configured_adk_log_level(self, caplog): + """to_a2a leaves the application's "google_adk" logger level unchanged.""" + with caplog.at_level(logging.WARNING, logger="google_adk"): + to_a2a(self.mock_agent) + + assert logging.getLogger("google_adk").level == logging.WARNING + # --------------------------------------------------------------------------- # Behavioral hosting checks (real Starlette; drive lifespan; assert routes). # ---------------------------------------------------------------------------