修改hilog日志默认开启debug级别的bug

Signed-off-by: deveco_xdevice <liguangjie1@huawei.com>
This commit is contained in:
deveco_xdevice 2023-11-08 16:58:36 +08:00
parent 1859abf47c
commit 3bbefe10b7
2 changed files with 15 additions and 18 deletions

View File

@ -886,6 +886,17 @@ class DeviceLogCollector:
def __init__(self, device):
self.device = device
def _set_device_log_level(self, **kwargs):
# set device log level
if not self.device_log_level:
log_level = kwargs.get("log_level", "INFO")
if log_level not in LOGLEVEL:
self.device_log_level = "INFO"
else:
self.device_log_level = log_level
cmd = "hilog -b {}".format(self.device_log_level)
self.device.execute_shell_command(cmd)
def restart_catch_device_log(self):
self._sync_device_time()
for _, path in enumerate(self.hilog_file_address):
@ -910,15 +921,7 @@ class DeviceLogCollector:
the logs in files.
"""
self._sync_device_time()
# set device log level
if not self.device_log_level:
log_level = kwargs.get("log_level", "DEBUG")
if log_level not in LOGLEVEL:
self.device_log_level = "DEBUG"
else:
self.device_log_level = log_level
cmd = "hilog -b {}".format(self.device_log_level)
self.device.execute_shell_command(cmd)
self._set_device_log_level(**kwargs)
device_hilog_proc = None
if hilog_file_pipe:
@ -971,14 +974,7 @@ class DeviceLogCollector:
self.device.execute_shell_command(cmd)
cmd = "rm -rf /data/log/hilog/*.gz"
# set device log level
if not self.device_log_level:
log_level = kwargs.get("log_level", "DEBUG")
if log_level not in LOGLEVEL:
self.device_log_level = "DEBUG"
else:
self.device_log_level = log_level
cmd = "hilog -b {}".format(self.device_log_level)
self.device.execute_shell_command(cmd)
self._set_device_log_level(**kwargs)
# 开始日志任务 设置落盘文件个数最大值1000, 单个文件20M链接https://gitee.com/openharmony/hiviewdfx_hilog
cmd = "hilog -w start -l {} -n 1000".format(log_size)
out = self.device.execute_shell_command(cmd)

View File

@ -256,7 +256,8 @@ class UserConfigManager(object):
else:
data_dic.update({ConfigConst.tag_enable: str(node.text).strip()})
data_dic.update({ConfigConst.tag_dir: None})
data_dic.update({ConfigConst.tag_loglevel: "DEBUG"})
data_dic.update({ConfigConst.tag_loglevel: "INFO"})
data_dic.update({ConfigConst.tag_clear: "TRUE"})
return data_dic
def environment_enable(self):