diff options
author | Satoshi Fujii <fujii-satoshi@jp.fujitsu.com> | 2021-10-22 12:30:45 +0000 |
---|---|---|
committer | Satoshi Fujii <fujii-satoshi@jp.fujitsu.com> | 2021-10-22 12:58:05 +0000 |
commit | 8d7c0201456b7f9af6e91fea90354f4c3de323fe (patch) | |
tree | 522632565397508044ba2de89313616f3aa495a6 /miss_htbt_service/misshtbtd.py | |
parent | c48b9767a6bcad91f89fc3fded0b6024e89525c0 (diff) |
Fix log rotation issue
Writing log to a single file from multiple processes is not supported
by python logging. It causes making fragmented log files at log
rotation and logs are mixed up.
This change is to use different log files for each sub-process
to help developers check log for a specific process easily.
This change does not affect to pod log (stdout log).
Signed-off-by: Satoshi Fujii <fujii-satoshi@jp.fujitsu.com>
Issue-ID: DCAEGEN2-2941
Change-Id: If8bcb2308863d1395a2c547d2e7b746301665fb0
Diffstat (limited to 'miss_htbt_service/misshtbtd.py')
-rw-r--r-- | miss_htbt_service/misshtbtd.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/miss_htbt_service/misshtbtd.py b/miss_htbt_service/misshtbtd.py index 61da9d9..6be2260 100644 --- a/miss_htbt_service/misshtbtd.py +++ b/miss_htbt_service/misshtbtd.py @@ -28,6 +28,7 @@ # # Author Prakash Hosangady(ph553f@att.com) import shutil +import logging import traceback import os import sys @@ -49,6 +50,7 @@ from mod import trapd_settings as tds from mod.trapd_get_cbs_config import get_cbs_config hb_properties_file = path.abspath(path.join(__file__, "../config/hbproperties.yaml")) +_logger = logging.getLogger(__name__) ABSOLUTE_PATH1 = path.abspath(path.join(__file__, "../htbtworker.py")) ABSOLUTE_PATH2 = path.abspath(path.join(__file__, "../db_monitoring.py")) @@ -319,10 +321,8 @@ def create_process(job_list, jsfile, pid_current): return job_list -_logger = get_logger.get_logger(__name__) - - def main(): + get_logger.configure_logger('misshtbtd') pid_current = os.getpid() hc_proc = multiprocessing.Process(target=check_health.start_health_check_server) cbs_polling_proc = multiprocessing.Process(target=cbs_polling.cbs_polling_loop, args=(pid_current,)) |