Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

fix: add exception handling for logger retrieval in cold storage object key generation

soojin1585f5b9209f
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index 07cb1d8662b..ca8a1931648 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -4161,10 +4161,14 @@ class StandardLoggingPayloadSetup:
# Get the actual s3_path from the configured cold storage logger instance
s3_path = "" # default value
- # Get the actual logger instance from the logger name
- custom_logger = litellm.logging_callback_manager.get_active_custom_logger_for_callback_name(configured_cold_storage_logger)
- if custom_logger and hasattr(custom_logger, 's3_path') and custom_logger.s3_path:
- s3_path = custom_logger.s3_path
+ # Try to get the actual logger instance from the logger name
+ try:
+ custom_logger = litellm.logging_callback_manager.get_active_custom_logger_for_callback_name(configured_cold_storage_logger)
+ if custom_logger and hasattr(custom_logger, 's3_path') and custom_logger.s3_path:
+ s3_path = custom_logger.s3_path
+ except Exception:
+ # If any error occurs in getting the logger instance, use default empty s3_path
+ pass
s3_object_key = get_s3_object_key(
s3_path=s3_path, # Use actual s3_path from logger configuration