|
18 | 18 | enrich_byok_rag, |
19 | 19 | enrich_solr, |
20 | 20 | ) |
21 | | -from log import get_logger |
| 21 | +from log import get_logger, setup_logging |
22 | 22 | from models.api.responses.error import ServiceUnavailableResponse |
23 | 23 | from models.config import LlamaStackConfiguration |
24 | 24 | from utils.types import Singleton |
@@ -66,6 +66,11 @@ async def _load_library_client(self, config: LlamaStackConfiguration) -> None: |
66 | 66 | await client.initialize() |
67 | 67 | self._lsc = client |
68 | 68 |
|
| 69 | + # Re-apply logging configuration after ogx's setup_logging() is called. |
| 70 | + # This ensures the desired logging configuration is applied when |
| 71 | + # using AsyncLlamaStackAsLibraryClient. |
| 72 | + setup_logging() |
| 73 | + |
69 | 74 | def _load_service_client(self, config: LlamaStackConfiguration) -> None: |
70 | 75 | """Initialize client in service mode (remote HTTP).""" |
71 | 76 | logger.info("Using Llama stack running as a service") |
@@ -151,6 +156,11 @@ async def reload_library_client(self) -> AsyncLlamaStackClient: |
151 | 156 | ) |
152 | 157 | raise HTTPException(**error_response.model_dump()) from e |
153 | 158 | self._lsc = client |
| 159 | + # Re-apply logging configuration after ogx's setup_logging() is called. |
| 160 | + # This ensures the desired logging configuration is applied when |
| 161 | + # using AsyncLlamaStackAsLibraryClient. |
| 162 | + setup_logging() |
| 163 | + |
154 | 164 | return client |
155 | 165 |
|
156 | 166 | async def check_model_available(self, model_id: str) -> tuple[bool, str]: |
@@ -247,6 +257,11 @@ async def update_azure_token(self) -> AsyncLlamaStackClient: |
247 | 257 | ) |
248 | 258 | await client.initialize() |
249 | 259 | self._lsc = client |
| 260 | + # Re-apply logging configuration after ogx's setup_logging() is called. |
| 261 | + # This ensures the desired logging configuration is applied when |
| 262 | + # using AsyncLlamaStackAsLibraryClient. |
| 263 | + setup_logging() |
| 264 | + |
250 | 265 | return client |
251 | 266 |
|
252 | 267 | # Service client mode |
|
0 commit comments