fix: apply APP_LOG_LEVEL to framework loggers too#35
Merged
Conversation
`logging.basicConfig` only configures the root logger. Live logs from
the deployed pod still streamed INFO in the framework's loguru-style
format despite `APP_LOG_LEVEL=WARNING`, e.g.:
HH:MM:SS.mmm | INFO | Started server process [PID]
HH:MM:SS.mmm | INFO | <addr> | "GET /health" 200 OK
Tracing it: `Runner.cli()` calls
`vision_agents.core.utils.logging.configure_sdk_logger` and
`configure_fastapi_loggers`. Both install their own `StreamHandler`
on the `vision_agents`, `fastapi`, `uvicorn`, `uvicorn.access`, and
`uvicorn.error` loggers and set `propagate=False`. Root-level
`basicConfig` never reaches them.
Both helpers contain the guard:
if _logger.level == logging.NOTSET:
_logger.setLevel(level)
So pre-setting the level explicitly survives the framework's setup.
Loop over the five loggers and apply `_log_level` to each before
`Runner.cli()` runs.
|
@aliev must be a member of the GetStreamio team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
logging.basicConfigonly configures the root logger. Live logs from the deployed pod still streamed INFO in the framework's loguru-style format despiteAPP_LOG_LEVEL=WARNING:Runner.cli()callsvision_agents.core.utils.logging.configure_sdk_loggerandconfigure_fastapi_loggers. Both install their ownStreamHandleron thevision_agents,fastapi,uvicorn,uvicorn.access, anduvicorn.errorloggers and setpropagate=False. Root-levelbasicConfignever reaches them.Both helpers contain the guard:
So pre-setting the level explicitly survives the framework's setup. Loop over the five loggers and apply
_log_levelto each beforeRunner.cli()runs.