UPDATE: snapshot中rules路径使用原始输入的file_path;日志中__FILE__字段使用创建handle时输入的file_path
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[global]
|
||||
default format = "%d(%c), %V, %U, %m%n"
|
||||
default format = "%d(%c), %V, %F, %U, %m%n"
|
||||
[levels]
|
||||
DEBUG=10
|
||||
INFO=20
|
||||
|
||||
@@ -116,7 +116,7 @@ static void escape_for_zlog(char *in_buf, int buflen)
|
||||
return;
|
||||
}
|
||||
|
||||
static void snapshot_handle_info(const char *handle_name, 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];
|
||||
if (g_zlog_conf_fp == -1)
|
||||
@@ -133,13 +133,13 @@ static void snapshot_handle_info(const char *handle_name, int level)
|
||||
return;
|
||||
}
|
||||
int len = snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
||||
"[global]\ndefault format = \"%%d(%%c), %%V, %U, %%m%%n\" \n[levels]\nDEBUG=10\nINFO=20\nFATAL=30\n[rules]");
|
||||
"[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);
|
||||
}
|
||||
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
||||
"\n%s.%d \"%s.%%d(%%F)\"",
|
||||
handle_name, level, handle_name);
|
||||
handle_name, level, log_path);
|
||||
write(g_zlog_conf_fp, zlog_rule_conf_content, strlen(zlog_rule_conf_content));
|
||||
fsync(g_zlog_conf_fp);
|
||||
return;
|
||||
@@ -169,7 +169,7 @@ void *MESA_create_runtime_log_handle(const char *file_path, int level)
|
||||
if (create_path(file_path, p_path_end - file_path) < 0)
|
||||
return NULL;
|
||||
|
||||
snapshot_handle_info(p_name, level);
|
||||
snapshot_handle_info(p_name, file_path, level);
|
||||
zc = zlog_get_category(p_name);
|
||||
if (!zc)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ void MESA_handle_runtime_log(void *handle, int level, const char *module, const
|
||||
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vzlog(p_handle->zc, __FILE__, sizeof(__FILE__) - 1, module, strlen(module), __LINE__, level, fmt, ap);
|
||||
vzlog(p_handle->zc, p_handle->runtime_log_file, strlen(p_handle->runtime_log_file), module, strlen(module), __LINE__, level, fmt, ap);
|
||||
va_end(ap);
|
||||
return ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user