OCT 1. 启动时判断log配置文件是否存在,并打印提示信息

This commit is contained in:
huangxin 2023-02-06 10:13:49 +08:00
parent c4c3b5bf81
commit bf05af5140
1 changed files with 9 additions and 5 deletions

View File

@ -76,6 +76,7 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK
utstring_new(pPath); utstring_new(pPath);
utstring_printf(pPath, "%s/%s", bufCfgDir, "zlog.conf"); utstring_printf(pPath, "%s/%s", bufCfgDir, "zlog.conf");
if (file_exists(utstring_body(pPath))) {
if ((ret = dzlog_init(utstring_body(pPath), get_cur_process_name())) != ERR_SUCCESS) { if ((ret = dzlog_init(utstring_body(pPath), get_cur_process_name())) != ERR_SUCCESS) {
printf("Zlog configure file [%s] init result: %d+++++\n", utstring_body(pPath), ret); printf("Zlog configure file [%s] init result: %d+++++\n", utstring_body(pPath), ret);
zlog_profile(); zlog_profile();
@ -83,6 +84,9 @@ int user_init(const char *pAppCfgFile, const char *pCfgDirectory, const char *pK
} else { } else {
dzlog_info("Zlog used configure file [%s]\n", utstring_body(pPath)); dzlog_info("Zlog used configure file [%s]\n", utstring_body(pPath));
} }
} else {
printf("Zlog configure file [%s] not found, Zlog system not work+++++\n", utstring_body(pPath));
}
zlog_level_switch(zlog_get_category(get_cur_process_name()), zlog_level_switch(zlog_get_category(get_cur_process_name()),
logLevel > ZLOG_LEVEL_DEBUG ? logLevel : ZLOG_LEVEL_DEBUG); logLevel > ZLOG_LEVEL_DEBUG ? logLevel : ZLOG_LEVEL_DEBUG);