summaryrefslogtreecommitdiffstats
path: root/miss_htbt_service/db_monitoring.py
diff options
context:
space:
mode:
authorSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-10-22 12:30:45 +0000
committerSatoshi Fujii <fujii-satoshi@jp.fujitsu.com>2021-10-22 12:58:05 +0000
commit8d7c0201456b7f9af6e91fea90354f4c3de323fe (patch)
tree522632565397508044ba2de89313616f3aa495a6 /miss_htbt_service/db_monitoring.py
parentc48b9767a6bcad91f89fc3fded0b6024e89525c0 (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/db_monitoring.py')
-rw-r--r--miss_htbt_service/db_monitoring.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/miss_htbt_service/db_monitoring.py b/miss_htbt_service/db_monitoring.py
index 32e8edc..a405876 100644
--- a/miss_htbt_service/db_monitoring.py
+++ b/miss_htbt_service/db_monitoring.py
@@ -24,6 +24,7 @@
# and generates Missing Heartbeat signal for Policy Engine
import json
+import logging
import sys
import os
import socket
@@ -33,7 +34,7 @@ import htbtworker as pm
import misshtbtd as db
import get_logger
-_logger = get_logger.get_logger(__name__)
+_logger = logging.getLogger(__name__)
def sendControlLoopEvent(CLType, pol_url, policy_version, policy_name, policy_scope, target_type, srcName, epoc_time,
@@ -232,6 +233,7 @@ def db_monitoring(current_pid, json_file, user_name, password, ip_address, port_
if __name__ == "__main__":
+ get_logger.configure_logger('db_monitoring')
_logger.info("DBM: DBM Process started")
current_pid = sys.argv[1]
jsfile = sys.argv[2]