From c4d64ebb08c05333fe1eb0c2528cada868fbf613 Mon Sep 17 00:00:00 2001 From: Peter Verveer Date: Tue, 3 Dec 2024 16:21:47 +0100 Subject: [PATCH] Fix the azure logging handler in Everest * Fix the azure logging handler in Everest Co-authored-by: DanSava --- src/everest/detached/jobs/everserver.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/everest/detached/jobs/everserver.py b/src/everest/detached/jobs/everserver.py index 37fc437c0b2..c11f57d33bd 100755 --- a/src/everest/detached/jobs/everserver.py +++ b/src/everest/detached/jobs/everserver.py @@ -208,6 +208,12 @@ def make_handler_config( "filename": path, } + def azure_handler(): + azure_handler = get_azure_logging_handler() + if azure_handler: + return azure_handler + return logging.NullHandler() + logging_config = { "version": 1, "disable_existing_loggers": False, @@ -219,12 +225,13 @@ def make_handler_config( "forward_models": make_handler_config( log_dir / "forward_models.log", logging_level ), + "azure_handler": {"()": azure_handler}, }, "loggers": { "": {"handlers": ["root"], "level": "NOTSET"}, "res": {"handlers": ["res"]}, "everserver": {"handlers": ["everserver"]}, - "everest": {"handlers": ["everest"]}, + "everest": {"handlers": ["everest", "azure_handler"]}, "forward_models": {"handlers": ["forward_models"]}, }, "formatters": { @@ -232,14 +239,6 @@ def make_handler_config( }, } - azure_handler = get_azure_logging_handler() - if azure_handler: - logging_config["handlers"]["azure"] = { - "class": "azure_handler", - "level": logging_level, - } - logging_config["loggers"]["everest"]["handlers"].append("azure") - logging.config.dictConfig(logging_config)