-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Summary
Category-specific log levels configured via LLAMA_STACK_LOGGING environment variable are not applied to loggers that are created before setup_logging() is called.
Impact
When debugging specific categories (e.g., core=debug), log messages from modules imported early in the initialization process don't respect the configured log level and remain at the default level.
Reproduction Steps
- Set the environment variable:
export LLAMA_STACK_LOGGING=core=debug-
Start the llama-stack server
-
Observe that the DEBUG level log message from
src/llama_stack/core/stack.py:488is not displayed:
logger.debug("refreshing registry")Expected Behavior
All loggers with category="core" should log at DEBUG level when LLAMA_STACK_LOGGING=core=debug is set, regardless of when the logger was initialized.
Actual Behavior
Loggers created before setup_logging() is called (e.g., in stack.py imported at server startup) do not respect category-specific log levels and remain at the default log level.
Root Cause
Loggers are created via get_logger() at module import time before setup_logging() is called. The existing implementation in setup_logging() only applies the root level to pre-existing llama_stack loggers, ignoring their individual category assignments stored in _category_levels.