Skip to content

to_a2a() overrides the google_adk logger level set by the application聽#7462

Description

@ankit2235

馃敶 Required Information

Describe the Bug:
to_a2a() calls logging.getLogger("google_adk").setLevel(logging.INFO) every time it runs, so whatever level the application already set on the google_adk logger gets replaced with INFO.

This shows up when serving the app with something like uvicorn my_agent:a2a_app --log-config logging.json where the config sets google_adk to DEBUG. Uvicorn applies the log config before importing the module, then to_a2a() runs at import time and puts the level back to INFO, so the ADK debug logs never appear. It works the other way too: if you turn google_adk down to WARNING to quiet it, INFO messages come back after calling to_a2a().

The comment above that line says it's there so logs are visible when running under uvicorn directly, but it doesn't really achieve that. Uvicorn's default logging config doesn't put a handler on the root logger, so ADK's INFO records aren't printed with or without the line.

Steps to Reproduce:

  1. Install google-adk
  2. Run the snippet below
  3. It prints INFO instead of DEBUG

Expected Behavior:
to_a2a() should leave the logger level alone. Logging configuration belongs to the application.

Observed Behavior:
The google_adk logger is always at INFO after to_a2a() returns, regardless of what was configured before.

Environment Details:

  • ADK Library Version (pip show google-adk): 2.11.0 (main at b3ccb29)
  • Desktop OS: Linux
  • Python Version (python -V): 3.11.16

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: N/A, not model related

馃煛 Optional Information

Regression:
No. The line has been there since to_a2a was first added.

Minimal Reproduction Code:

import logging

from google.adk.a2a.utils.agent_to_a2a import to_a2a
from google.adk.agents import LlmAgent

logging.basicConfig(level=logging.INFO)
logging.getLogger("google_adk").setLevel(logging.DEBUG)

app = to_a2a(LlmAgent(name="probe", model="gemini-2.5-flash"))

print(logging.getLevelName(logging.getLogger("google_adk").level))  # INFO

How often has this issue occurred?:

  • Always (100%)

Additional Context:
Happy to send a PR for this. The fix is to drop the setLevel call (the adk_logger variable is still used by two warnings further down) and add a regression test.

Activity

  1. surajksharma07 commented on Oct 9, 2026

    @surajksharma07
    Collaborator

    Reproduced this on 2.11.0 and current main and dropping the setLevel line as in #7463 fixed it locally (the a2a utils tests pass too) @ankit2235.

    Until it lands a workaround worth trying: set the level again right after the call, e.g. app = to_a2a(agent) followed by logging.getLogger("google_adk").setLevel(logging.DEBUG). Could you check whether that works with your uvicorn --log-config setup?

    On the NOTSET question removing the line completely seems cleanest but will leave that to the reviewers. Please give the PR one more full run on your end so we know it's solid before review.

  2. added
    a2a[Component] This issue is related a2a support inside ADK.
    on Oct 9, 2026
  3. ankit2235 commented on Oct 9, 2026

    @ankit2235
    Author

    Thanks for reproducing and triaging this @surajksharma07.

    The workaround works. On unpatched main, with the same uvicorn --log-config setup (google_adk set to DEBUG), adding logging.getLogger("google_adk").setLevel(logging.DEBUG) right after the to_a2a() call brings the debug output back. Both the "before" and "after" debug lines show up.

    I also did a full run with the fix applied on top of current main (3d11f9f):

    pytest tests/unittests -n 4
    18418 passed, 86 skipped, 24 xfailed, 2 xpassed
    

    No failures. And agreed on removing the line completely, happy to go with whatever the reviewers prefer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

a2a[Component] This issue is related a2a support inside ADK.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions