set log rotate time format

pull/48/head^2
yuqing 2015-08-16 11:20:38 +08:00
parent 2b5d703542
commit c25d3a7d01
5 changed files with 24 additions and 6 deletions

View File

@ -1,10 +1,11 @@
Version 5.07 2015-08-15
Version 5.07 2015-08-16
* schedule task add the "second" field
* make.sh changed, you must upgrade libfastcommon to V1.20 or later
* bug fixed: storage_disk_recovery.c skip the first file (binlog first line)
* bug fixed: should close connection after fetch binlog
* fdfs_storaged.c: advance the position of daemon_init
* set log rotate time format
Version 5.06 2015-05-12
* compile passed in mac OS Darwin

View File

@ -1693,7 +1693,7 @@ int storage_func_init(const char *filename, \
rotate_access_log_size);
rotate_access_log_size = FDFS_ONE_MB;
}
g_access_log_context.rotate_size = rotate_access_log_size;
fdfs_set_log_rotate_size(&g_access_log_context, rotate_access_log_size);
pRotateErrorLogSize = iniGetStrValue(NULL, \
"rotate_error_log_size", &iniContext);
@ -1716,7 +1716,7 @@ int storage_func_init(const char *filename, \
rotate_error_log_size);
rotate_error_log_size = FDFS_ONE_MB;
}
g_log_context.rotate_size = rotate_error_log_size;
fdfs_set_log_rotate_size(&g_log_context, rotate_error_log_size);
g_log_file_keep_days = iniGetIntValue(NULL, \
"log_file_keep_days", &iniContext, 0);

View File

@ -1016,3 +1016,17 @@ void fdfs_connection_pool_destroy()
conn_pool_destroy(&g_connection_pool);
}
void fdfs_set_log_rotate_size(LogContext *pContext, const int64_t log_rotate_size)
{
if (log_rotate_size > 0)
{
pContext->rotate_size = log_rotate_size;
log_set_rotate_time_format(pContext, "%Y%m%d_%H%M%S");
}
else
{
pContext->rotate_size = 0;
log_set_rotate_time_format(pContext, "%Y%m%d");
}
}

View File

@ -13,6 +13,7 @@
#include "common_define.h"
#include "ini_file_reader.h"
#include "logger.h"
#include "tracker_types.h"
#ifdef __cplusplus
@ -77,6 +78,8 @@ int fdfs_connection_pool_init(const char *config_filename, \
void fdfs_connection_pool_destroy();
void fdfs_set_log_rotate_size(LogContext *pContext, const int64_t log_rotate_size);
#ifdef __cplusplus
}
#endif

View File

@ -603,7 +603,7 @@ int tracker_load_from_conf_file(const char *filename, \
rotate_error_log_size);
rotate_error_log_size = FDFS_ONE_MB;
}
g_log_context.rotate_size = rotate_error_log_size;
fdfs_set_log_rotate_size(&g_log_context, rotate_error_log_size);
g_log_file_keep_days = iniGetIntValue(NULL, \
"log_file_keep_days", &iniContext, 0);