mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
fix: add exception handling for logger retrieval in cold storage object key generation
- Wrap get_active_custom_logger_for_callback_name call in try-except block - Gracefully handle cases where logger instance cannot be retrieved - Fall back to empty s3_path when logger lookup fails - Prevents crashes when cold storage logger is misconfigured or unavailable
This commit is contained in:
parent
488b373835
commit
1585f5b920
1 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue