更新写入snapshot默认部分的定义为const static buff
This commit is contained in:
@@ -127,7 +127,8 @@ static const char *loglevel_to_name(int level)
|
|||||||
|
|
||||||
static void snapshot_handle_info(const char *handle_name, const char *log_path, int level)
|
static void snapshot_handle_info(const char *handle_name, const char *log_path, int level)
|
||||||
{
|
{
|
||||||
char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1];
|
char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1] = "";
|
||||||
|
static char *zlog_conf_init_buff = "[global]\ndefault format = \"%%d(%%c), %%V, %F, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]";
|
||||||
if (g_zlog_conf_fp == -1)
|
if (g_zlog_conf_fp == -1)
|
||||||
{
|
{
|
||||||
char temp_filename[1024] = "";
|
char temp_filename[1024] = "";
|
||||||
@@ -141,9 +142,7 @@ static void snapshot_handle_info(const char *handle_name, const char *log_path,
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int len = snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
write(g_zlog_conf_fp, zlog_conf_init_buff, strlen(zlog_conf_init_buff));
|
||||||
"[global]\ndefault format = \"%%d(%%c), %%V, %F, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]");
|
|
||||||
write(g_zlog_conf_fp, zlog_rule_conf_content, strlen(zlog_rule_conf_content));
|
|
||||||
fsync(g_zlog_conf_fp);
|
fsync(g_zlog_conf_fp);
|
||||||
}
|
}
|
||||||
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
||||||
|
|||||||
Reference in New Issue
Block a user