From c22911e9899f5d112e0d3820f20a6be33945374f Mon Sep 17 00:00:00 2001 From: Ricky Ng-Adam Date: Tue, 20 Aug 2024 09:37:22 -0400 Subject: [PATCH] fixes #3186: check that the section handler_timed_file_handler exists before trying to modify it Signed-off-by: Ricky Ng-Adam --- aries_cloudagent/config/logging.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/aries_cloudagent/config/logging.py b/aries_cloudagent/config/logging.py index 9d74b0b0a7..217d2bf77e 100644 --- a/aries_cloudagent/config/logging.py +++ b/aries_cloudagent/config/logging.py @@ -119,18 +119,19 @@ def fileConfig( raise RuntimeError(f"{fname} is invalid: {e}") if new_file_path: - cp.set( - "handler_timed_file_handler", - "args", - str( - ( - f"{new_file_path}", - "d", - 7, - 1, - ) - ), - ) + if cp.has_section("handler_timed_file_handler"): + cp.set( + "handler_timed_file_handler", + "args", + str( + ( + f"{new_file_path}", + "d", + 7, + 1, + ) + ), + ) formatters = _create_formatters(cp) with logging._lock: