mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-10 04:08:31 +00:00
fix: respect log_level in uvicorn and third party libs
uvicorn has a `log_level` arg in uvicorn.run, pass in the effective level set by the logger. Additionally, third party libraries like httpx are using our logging format, but not honoring our log level. This seems unintended, so loop through all items in the loggerDict and apply the same log level as what we have set. Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
00da911167
commit
2dc458c4f6
2 changed files with 6 additions and 0 deletions
|
@ -422,6 +422,7 @@ def main():
|
||||||
"host": listen_host,
|
"host": listen_host,
|
||||||
"port": port,
|
"port": port,
|
||||||
"lifespan": "on",
|
"lifespan": "on",
|
||||||
|
"log_level": logger.getEffectiveLevel(),
|
||||||
}
|
}
|
||||||
if ssl_config:
|
if ssl_config:
|
||||||
uvicorn_config.update(ssl_config)
|
uvicorn_config.update(ssl_config)
|
||||||
|
|
|
@ -170,6 +170,11 @@ def setup_logging(category_levels: Dict[str, int], log_file: str | None) -> None
|
||||||
}
|
}
|
||||||
dictConfig(logging_config)
|
dictConfig(logging_config)
|
||||||
|
|
||||||
|
# Ensure third-party libraries follow the root log level
|
||||||
|
for _, logger in logging.root.manager.loggerDict.items():
|
||||||
|
if isinstance(logger, logging.Logger):
|
||||||
|
logger.setLevel(root_level)
|
||||||
|
|
||||||
|
|
||||||
def get_logger(name: str, category: str = "uncategorized") -> logging.LoggerAdapter:
|
def get_logger(name: str, category: str = "uncategorized") -> logging.LoggerAdapter:
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue