mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 01:48:05 +00:00
fix: call setup_logging early to apply category-specific log levels (#4253)
Category-specific log levels from LLAMA_STACK_LOGGING were not applied
to
loggers created before setup_logging() was called. This fix moves the
setup_logging() call earlier in the initialization sequence to ensure
all
loggers respect their configured levels regardless of initialization
timing.
Closes: #4252
Signed-off-by: Derek Higgins <derekh@redhat.com>
This commit is contained in:
parent
2fce5abe34
commit
fbf6c30cdc
3 changed files with 9 additions and 7 deletions
|
|
@ -8,6 +8,9 @@ import argparse
|
||||||
|
|
||||||
from llama_stack.log import setup_logging
|
from llama_stack.log import setup_logging
|
||||||
|
|
||||||
|
# Initialize logging early before any loggers get created
|
||||||
|
setup_logging()
|
||||||
|
|
||||||
from .stack import StackParser
|
from .stack import StackParser
|
||||||
from .stack.utils import print_subcommand_description
|
from .stack.utils import print_subcommand_description
|
||||||
|
|
||||||
|
|
@ -44,9 +47,6 @@ class LlamaCLIParser:
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Initialize logging from environment variables before any other operations
|
|
||||||
setup_logging()
|
|
||||||
|
|
||||||
parser = LlamaCLIParser()
|
parser = LlamaCLIParser()
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
parser.run(args)
|
parser.run(args)
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ from llama_stack.core.stack import (
|
||||||
from llama_stack.core.utils.config import redact_sensitive_fields
|
from llama_stack.core.utils.config import redact_sensitive_fields
|
||||||
from llama_stack.core.utils.config_resolution import Mode, resolve_config_or_distro
|
from llama_stack.core.utils.config_resolution import Mode, resolve_config_or_distro
|
||||||
from llama_stack.core.utils.context import preserve_contexts_async_generator
|
from llama_stack.core.utils.context import preserve_contexts_async_generator
|
||||||
from llama_stack.log import LoggingConfig, get_logger, setup_logging
|
from llama_stack.log import LoggingConfig, get_logger
|
||||||
from llama_stack_api import Api, ConflictError, PaginatedResponse, ResourceNotFoundError
|
from llama_stack_api import Api, ConflictError, PaginatedResponse, ResourceNotFoundError
|
||||||
|
|
||||||
from .auth import AuthenticationMiddleware
|
from .auth import AuthenticationMiddleware
|
||||||
|
|
@ -364,9 +364,6 @@ def create_app() -> StackApp:
|
||||||
Returns:
|
Returns:
|
||||||
Configured StackApp instance.
|
Configured StackApp instance.
|
||||||
"""
|
"""
|
||||||
# Initialize logging from environment variables first
|
|
||||||
setup_logging()
|
|
||||||
|
|
||||||
config_file = os.getenv("LLAMA_STACK_CONFIG")
|
config_file = os.getenv("LLAMA_STACK_CONFIG")
|
||||||
if config_file is None:
|
if config_file is None:
|
||||||
raise ValueError("LLAMA_STACK_CONFIG environment variable is required")
|
raise ValueError("LLAMA_STACK_CONFIG environment variable is required")
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,11 @@ import tempfile
|
||||||
import time
|
import time
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
# Initialize logging early before any loggers get created
|
||||||
|
from llama_stack.log import setup_logging
|
||||||
|
|
||||||
|
setup_logging()
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
import requests
|
import requests
|
||||||
import yaml
|
import yaml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue