8 Star 80 Fork 90

OpenHarmony / hiviewdfx_hilog_lite

 / 详情

apphilogcat服务默认将日志同时输出到串口和文件,严重影响性能,建议默认只输出到文件

Declined
Task
Opened this issue  
2021-11-17 15:15

【任务描述】

小型系统 hiview_applogcat.c中默认将日志也输出到串口:

# command/hilog_command.c 中silenceMod默认关闭:
HiviewConfig g_hiviewConfig = {
    .outputOption = OUTPUT_OPTION_FLOW,
    .level = LOG_DEBUG,
    .logSwitch = HIVIEW_FEATURE_ON,
    .dumpSwitch = HIVIEW_FEATURE_OFF,
     **.silenceMod = SILENT_MODE_OFF,** 
    .eventSwitch = HIVIEW_FEATURE_OFF,
    .logOutputModule = HILOG_MODULE_MAX,
};

# hiview_applogcat.c则会将日志输出到窗口,严重影响性能:
if (g_hiviewConfig.silenceMod == SILENT_MODE_OFF) {
   printf("%02d-%02d %02d:%02d:%02d.%03d %d %d %s\n", info->tm_mon + 1, info->tm_mday, info->tm_hour,
          info->tm_min, info->tm_sec, head->nsec / NANOSEC_PER_MIRCOSEC, head->pid, head->taskId, head->msg);
}

【解决方案】

# command/hilog_command.c 中将silenceMod默认打开:
HiviewConfig g_hiviewConfig = {
    .outputOption = OUTPUT_OPTION_FLOW,
    .level = LOG_DEBUG,
    .logSwitch = HIVIEW_FEATURE_ON,
    .dumpSwitch = HIVIEW_FEATURE_OFF,
     **.silenceMod = SILENT_MODE_ON,** 
    .eventSwitch = HIVIEW_FEATURE_OFF,
    .logOutputModule = HILOG_MODULE_MAX,
};

【任务来源】

Comments (1)

leo_ysl created任务
enable_ohos_hiviewdfx_apphilogcat_init_release = false
enable_ohos_hiviewdfx_apphilogcat_init_debug = true                                                                                                                                                                                                                          
ohos_hiviewdfx_apphilogcat_log_level_release = 5
ohos_hiviewdfx_apphilogcat_log_level_debug = 3
apphilogcat_on = 1
apphilogcat_off = 0
enable_ohos_hiviewdfx_hilogcat_build = true

这个功能默认受release、debug版本控制,也可以通过gn_args指定
base/hiviewdfx/hilog_lite/services/apphilogcat/BUILD.gn

stesen changed issue state from 待办的 to 已拒绝

Sign in to comment

Status
Assignees
Projects
Milestones
Pull Requests
Successfully merging a pull request will close this issue.
Branches
Planed to start   -   Planed to end
-
Top level
Priority
Duration (hours)
参与者(2)
5200794 stesen 1599180294
1
https://git.oschina.net/openharmony/hiviewdfx_hilog_lite.git
git@git.oschina.net:openharmony/hiviewdfx_hilog_lite.git
openharmony
hiviewdfx_hilog_lite
hiviewdfx_hilog_lite

Search