mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-03 04:19:18 +08:00
Fix clean log without pytest xdist (#11518)
Signed-off-by: ThreadDao <yufen.zong@zilliz.com>
This commit is contained in:
parent
7dcb8c708b
commit
b8a6a8dac0
@ -157,8 +157,10 @@ def initialize_env(request):
|
||||
assert ip_check(host) and number_check(port)
|
||||
|
||||
""" modify log files """
|
||||
cf.modify_file(file_path_list=[log_config.log_debug, log_config.log_info, log_config.log_err, log_config.log_worker],
|
||||
is_modify=clean_log)
|
||||
file_path_list = [log_config.log_debug, log_config.log_info, log_config.log_err]
|
||||
if log_config.log_worker != "":
|
||||
file_path_list.append(log_config.log_worker)
|
||||
cf.modify_file(file_path_list=file_path_list, is_modify=clean_log)
|
||||
|
||||
log.info("#" * 80)
|
||||
log.info("[initialize_milvus] Log cleaned up, start testing...")
|
||||
|
@ -18,6 +18,7 @@ class TestLog:
|
||||
try:
|
||||
formatter = logging.Formatter("[%(asctime)s - %(levelname)s - %(name)s]: "
|
||||
"%(message)s (%(filename)s:%(lineno)s)")
|
||||
# [%(process)s] process NO.
|
||||
dh = logging.FileHandler(self.log_debug)
|
||||
dh.setLevel(logging.DEBUG)
|
||||
dh.setFormatter(formatter)
|
||||
@ -41,7 +42,7 @@ class TestLog:
|
||||
ch = logging.StreamHandler(sys.stdout)
|
||||
ch.setLevel(logging.DEBUG)
|
||||
ch.setFormatter(formatter)
|
||||
# self.log.addHandler(ch)
|
||||
self.log.addHandler(ch)
|
||||
|
||||
except Exception as e:
|
||||
print("Can not use %s or %s or %s to log. error : %s" % (log_debug, log_file, log_err, str(e)))
|
||||
|
Loading…
Reference in New Issue
Block a user