From 62e1f94816e208c2e448b6b66b82b50cad1e8353 Mon Sep 17 00:00:00 2001 From: Robin Kupper Date: Tue, 2 May 2023 12:08:41 +0200 Subject: [PATCH] Remove file handler entirely if logfile not used. Signed-off-by: Robin Kupper --- mlflow_export_import/common/logging_utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mlflow_export_import/common/logging_utils.py b/mlflow_export_import/common/logging_utils.py index b656d870..688abaaf 100644 --- a/mlflow_export_import/common/logging_utils.py +++ b/mlflow_export_import/common/logging_utils.py @@ -52,7 +52,8 @@ def _create_default_log_config(output_path=None, log_format=None): file_handler = cfg["handlers"]["file"] file_handler["filename"] = output_path else: - handlers = cfg["root"]["handlers"] - handlers.remove("file") + # Remove file handler + del cfg["handlers"]["file"] + del cfg["root"]["handlers"]["file"] return cfg