migration-tools/0061-detection-abi-log.patch
2024-11-06 20:05:44 +08:00

47 lines
1.5 KiB
Diff

From d8be08a9ea07b3500a3b6460e9325014ffcf379b Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 10:16:10 +0800
Subject: [PATCH] =?UTF-8?q?ABI=E6=A3=80=E6=B5=8B=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E6=97=A5=E5=BF=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index cc48f45..e442cb5 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -160,4 +160,23 @@ def agent_ABI_check_result():
fp = open(agent_abi_check_result, 'a')
for rpm_name in open(abi_comp_chk):
fp.write(rpm_name.split(',')[0] + string)
- fp.close()
\ No newline at end of file
+ fp.close()
+
+
+def logger_init():
+ log_file = 'Abisystmcompchk.log' + '.' + datetime.datetime.now().strftime('%Y%m%d%H%M')
+ log_path = '/var/tmp/uos-migration/UOS_migration_log/'
+ if not os.path.exists(log_path):
+ os.makedirs(log_path)
+
+ logger = logging.getLogger()
+ logger.setLevel(logging.INFO)
+ log_name = log_path + log_file
+ logfile = log_name
+ fh = logging.FileHandler(logfile, mode='w')
+ fh.setLevel(logging.DEBUG)
+ formatter = logging.Formatter("%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s")
+ fh.setFormatter(formatter)
+ logger.addHandler(fh)
+
+ return logger
--
2.20.1