From 44ad4df107545b3a312d065d96b76230537fdb16 Mon Sep 17 00:00:00 2001 From: Antoine Brun Date: Wed, 2 Jul 2025 11:57:48 +0200 Subject: [PATCH 1/3] MSA-14861: comment out the file handler / ES only --- msa_sdk/__init__.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/msa_sdk/__init__.py b/msa_sdk/__init__.py index db0968aa..4e022649 100644 --- a/msa_sdk/__init__.py +++ b/msa_sdk/__init__.py @@ -18,20 +18,20 @@ context = Variables.load_context() -def add_file_handler(logger): - """Add default file handler.""" - if ('service_id' in context): - service_id = context['service_id'] - process_id = context['PROCESSINSTANCEID'] if 'PROCESSINSTANCEID' in context else "" - trace_id = context['TRACEID'] if "TRACEID" in context else "" - span_id = context['SPANID'] if "SPANID" in context else "" - # Create process log handler - process_log_path = '{}/process-{}.log'.format(constants.PROCESS_LOGS_DIRECTORY, service_id) - fh = logging.FileHandler(process_log_path) - formatter = logging.Formatter('%(asctime)s|' + process_id +'|' + VERSION + '|' + trace_id + '|' + span_id + '|%(module)s|' + socket.gethostname() + '|%(levelname)s\n%(message)s\n') - logging.Formatter.formatTime = (lambda self, record, datefmt=None: datetime.datetime.fromtimestamp(record.created, datetime.timezone.utc).astimezone().isoformat(sep="T",timespec="milliseconds")) - fh.setFormatter(formatter) - logger.addHandler(fh) +# def add_file_handler(logger): +# """Add default file handler.""" +# if ('service_id' in context): +# service_id = context['service_id'] +# process_id = context['PROCESSINSTANCEID'] if 'PROCESSINSTANCEID' in context else "" +# trace_id = context['TRACEID'] if "TRACEID" in context else "" +# span_id = context['SPANID'] if "SPANID" in context else "" +# # Create process log handler +# process_log_path = '{}/process-{}.log'.format(constants.PROCESS_LOGS_DIRECTORY, service_id) +# fh = logging.FileHandler(process_log_path) +# formatter = logging.Formatter('%(asctime)s|' + process_id +'|' + VERSION + '|' + trace_id + '|' + span_id + '|%(module)s|' + socket.gethostname() + '|%(levelname)s\n%(message)s\n') +# logging.Formatter.formatTime = (lambda self, record, datefmt=None: datetime.datetime.fromtimestamp(record.created, datetime.timezone.utc).astimezone().isoformat(sep="T",timespec="milliseconds")) +# fh.setFormatter(formatter) +# logger.addHandler(fh) # ES index def add_es_handler(logger): @@ -55,7 +55,7 @@ def add_std_err(logger): #logger.addHandler(handler) logger = logging.getLogger() -add_file_handler(logger) +#add_file_handler(logger) add_std_err(logger) add_es_handler(logger) From db636c7a9e766bc84e2aa87d424d47edff93661a Mon Sep 17 00:00:00 2001 From: Antoine Brun Date: Wed, 2 Jul 2025 12:01:59 +0200 Subject: [PATCH 2/3] MSA-14861: Update msa_sdk/__init__.py completely remove the code Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- msa_sdk/__init__.py | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/msa_sdk/__init__.py b/msa_sdk/__init__.py index 4e022649..d36bbf9a 100644 --- a/msa_sdk/__init__.py +++ b/msa_sdk/__init__.py @@ -18,20 +18,7 @@ context = Variables.load_context() -# def add_file_handler(logger): -# """Add default file handler.""" -# if ('service_id' in context): -# service_id = context['service_id'] -# process_id = context['PROCESSINSTANCEID'] if 'PROCESSINSTANCEID' in context else "" -# trace_id = context['TRACEID'] if "TRACEID" in context else "" -# span_id = context['SPANID'] if "SPANID" in context else "" -# # Create process log handler -# process_log_path = '{}/process-{}.log'.format(constants.PROCESS_LOGS_DIRECTORY, service_id) -# fh = logging.FileHandler(process_log_path) -# formatter = logging.Formatter('%(asctime)s|' + process_id +'|' + VERSION + '|' + trace_id + '|' + span_id + '|%(module)s|' + socket.gethostname() + '|%(levelname)s\n%(message)s\n') -# logging.Formatter.formatTime = (lambda self, record, datefmt=None: datetime.datetime.fromtimestamp(record.created, datetime.timezone.utc).astimezone().isoformat(sep="T",timespec="milliseconds")) -# fh.setFormatter(formatter) -# logger.addHandler(fh) +# Removed the commented-out `add_file_handler` function to reduce clutter and improve readability. # ES index def add_es_handler(logger): From 39c1306527b35f00296607314f47d175e0022da1 Mon Sep 17 00:00:00 2001 From: Antoine Brun Date: Wed, 2 Jul 2025 12:02:55 +0200 Subject: [PATCH 3/3] MSA-14861: remove the file handler / ES only --- msa_sdk/__init__.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/msa_sdk/__init__.py b/msa_sdk/__init__.py index d36bbf9a..7b300a38 100644 --- a/msa_sdk/__init__.py +++ b/msa_sdk/__init__.py @@ -18,8 +18,6 @@ context = Variables.load_context() -# Removed the commented-out `add_file_handler` function to reduce clutter and improve readability. - # ES index def add_es_handler(logger): """ES log handler.""" @@ -42,7 +40,6 @@ def add_std_err(logger): #logger.addHandler(handler) logger = logging.getLogger() -#add_file_handler(logger) add_std_err(logger) add_es_handler(logger)