From 3a9fdb674ae9c01d0a0c8e34002664ad38156b3f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 18 Feb 2026 18:12:00 +0100 Subject: [PATCH] Shorten logging output to time I am not sure we ever need the millisecond output. The date is typically also clear from the output (we could print the date at the beginning, once, instead, but this is not done here. Finally, in Jenkins, we typically get time stamps. Thus, it's not necessary to print this by default. On the other hand, since it might be useful when running locally, make time stamps in logs configurable. --- ci-scripts/args_parse.py | 6 +++++- ci-scripts/main.py | 14 ++++++-------- ci-scripts/run_locally.sh | 6 +++--- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ci-scripts/args_parse.py b/ci-scripts/args_parse.py index 3a3ea52fa0..48bca5644f 100644 --- a/ci-scripts/args_parse.py +++ b/ci-scripts/args_parse.py @@ -44,6 +44,7 @@ import constants as CONST def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER): force_local = False + date_fmt = None while len(argvs) > 1: myArgv = argvs.pop(1) # 0th is this file's name @@ -56,6 +57,9 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER): #consider inline parameters + elif re.match(r'^\-\-datefmt=(.+)$', myArgv, re.IGNORECASE): + matchReg = re.match(r'^\-\-datefmt=(.+)$', myArgv, re.IGNORECASE) + date_fmt = matchReg.group(1) elif re.match(r'^\-\-mode=(.+)$', myArgv, re.IGNORECASE): matchReg = re.match(r'^\-\-mode=(.+)$', myArgv, re.IGNORECASE) mode = matchReg.group(1) @@ -168,4 +172,4 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER): HELP.GenericHelp(CONST.Version) sys.exit('Invalid Parameter: ' + myArgv) - return mode, force_local + return mode, force_local, date_fmt diff --git a/ci-scripts/main.py b/ci-scripts/main.py index d86af05871..1abdda36ed 100644 --- a/ci-scripts/main.py +++ b/ci-scripts/main.py @@ -62,13 +62,6 @@ import lxml.etree as ET import logging import signal import traceback -logging.basicConfig( - level=logging.DEBUG, - stream=sys.stdout, - format="[%(asctime)s] %(levelname)8s: %(message)s" -) - - #----------------------------------------------------------- @@ -349,7 +342,12 @@ CLUSTER = cls_cluster.Cluster() import args_parse # Force local execution, move all execution targets to localhost force_local = False -mode, force_local = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER) +mode, force_local, date_fmt = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER) +fmt = "%(levelname)8s: %(message)s" +if date_fmt: + fmt = "[%(asctime)s] %(levelname)s %(message)s" +logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, format=fmt, datefmt=date_fmt,) + #----------------------------------------------------------- # mode amd XML class (action) analysis diff --git a/ci-scripts/run_locally.sh b/ci-scripts/run_locally.sh index 6423378e9c..645ac1a9fe 100755 --- a/ci-scripts/run_locally.sh +++ b/ci-scripts/run_locally.sh @@ -31,15 +31,15 @@ docker tag oai-nr-cuup oai-ci/oai-nr-cuup:develop-${SHORT_COMMIT_SHA} python3 main.py --mode=InitiateHtml --ranRepository=NONE --ranBranch=${CURRENT_BRANCH} \ --ranCommitID=${COMMIT_SHA} --ranAllowMerge=false \ --ranTargetBranch=NONE \ - --XMLTestFile=xml_files/${TESTCASE} --local + --XMLTestFile=xml_files/${TESTCASE} --local --datefmt="%H:%M:%S" python3 main.py --mode=TesteNB --ranRepository=NONE --ranBranch=${CURRENT_BRANCH} \ --ranCommitID=${COMMIT_SHA} --ranAllowMerge=false \ --ranTargetBranch=NONE \ --eNBSourceCodePath=${REPO_PATH} \ - --XMLTestFile=${TESTCASE} --local + --XMLTestFile=${TESTCASE} --local --datefmt="%H:%M:%S" RET=$? -python3 main.py --mode=FinalizeHtml --local +python3 main.py --mode=FinalizeHtml --local --datefmt="%H:%M:%S" exit ${RET}