更新reconstruction流程,对conf_path的判断交由zlog内部完成
This commit is contained in:
@@ -242,39 +242,35 @@ int MESA_handle_runtime_log_creation(const char *conf_path)
|
||||
|
||||
int MESA_handle_runtime_log_reconstruction(const char *conf_path)
|
||||
{
|
||||
int rc = zlog_reload(conf_path);
|
||||
#ifdef DEBUG
|
||||
char zlog_rule_conf_content[MAX_HANDLE_LOG_PATH + 1];
|
||||
time_t t;
|
||||
struct tm local_time;
|
||||
if (access(conf_path, R_OK) != -1)
|
||||
{
|
||||
int rc = zlog_reload(conf_path);
|
||||
#ifdef DEBUG
|
||||
static unsigned char weekday_str[7][4] =
|
||||
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
static unsigned char weekday_str[7][4] =
|
||||
{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
|
||||
|
||||
static unsigned char month_str[12][4] = {"Jan", "Feb", "Mar", "Apr",
|
||||
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
if (!rc)
|
||||
static unsigned char month_str[12][4] = {"Jan", "Feb", "Mar", "Apr",
|
||||
"May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
if (!rc)
|
||||
{
|
||||
strcpy(global_conf_filepath, conf_path);
|
||||
zlog_profile();
|
||||
if (g_zlog_conf_fp != -1)
|
||||
{
|
||||
strcpy(global_conf_filepath, conf_path);
|
||||
zlog_profile();
|
||||
if (g_zlog_conf_fp != -1)
|
||||
time(&t);
|
||||
if (NULL != (localtime_r(&t, &local_time)))
|
||||
{
|
||||
time(&t);
|
||||
if (NULL != (localtime_r(&t, &local_time)))
|
||||
{
|
||||
snprintf(zlog_rule_conf_content, sizeof(zlog_rule_conf_content),
|
||||
"\n%s %s %d %02d:%02d:%02d %d, RECONSTRUCTION to %s\n", weekday_str[local_time.tm_wday],
|
||||
month_str[local_time.tm_mon], local_time.tm_mday, local_time.tm_hour, local_time.tm_min, local_time.tm_sec, local_time.tm_year + 1900, conf_path);
|
||||
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 %s %d %02d:%02d:%02d %d, RECONSTRUCTION to %s\n", weekday_str[local_time.tm_wday],
|
||||
month_str[local_time.tm_mon], local_time.tm_mday, local_time.tm_hour, local_time.tm_min, local_time.tm_sec, local_time.tm_year + 1900, conf_path);
|
||||
write(g_zlog_conf_fp, zlog_rule_conf_content, strlen(zlog_rule_conf_content));
|
||||
fsync(g_zlog_conf_fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void MESA_handle_runtime_log_destruction()
|
||||
|
||||
Reference in New Issue
Block a user