mirror of
https://gitee.com/wangbin579/cetus.git
synced 2024-12-02 03:47:41 +08:00
change sql-log-path default value
This commit is contained in:
parent
5a956f4afa
commit
4e2fff79a2
@ -2,6 +2,7 @@
|
|||||||
#include "network-mysqld-packet.h"
|
#include "network-mysqld-packet.h"
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include<unistd.h>
|
||||||
|
|
||||||
const COM_STRING com_command_name[]={
|
const COM_STRING com_command_name[]={
|
||||||
{ C("Sleep") },
|
{ C("Sleep") },
|
||||||
@ -341,6 +342,14 @@ sql_log_thread_start(struct sql_log_mgr *mgr) {
|
|||||||
if (mgr->sql_log_path == NULL) {
|
if (mgr->sql_log_path == NULL) {
|
||||||
mgr->sql_log_path = g_strdup(SQL_LOG_DEF_PATH);
|
mgr->sql_log_path = g_strdup(SQL_LOG_DEF_PATH);
|
||||||
}
|
}
|
||||||
|
int result = access(mgr->sql_log_path, F_OK);
|
||||||
|
if (result != 0) {
|
||||||
|
g_message("sql log path is not exist, try to mkdir");
|
||||||
|
result = mkdir(mgr->sql_log_path, 0660);
|
||||||
|
if (result != 0) {
|
||||||
|
g_message("mkdir(%s) failed", mgr->sql_log_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mgr->sql_log_fullname == NULL) {
|
if (mgr->sql_log_fullname == NULL) {
|
||||||
mgr->sql_log_fullname = g_strdup_printf("%s/%s.%s", mgr->sql_log_path, mgr->sql_log_filename, SQL_LOG_DEF_SUFFIX);
|
mgr->sql_log_fullname = g_strdup_printf("%s/%s.%s", mgr->sql_log_path, mgr->sql_log_filename, SQL_LOG_DEF_SUFFIX);
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1162,7 @@ main_cmdline(int argc, char **argv)
|
|||||||
if (frontend->sql_log_path) {
|
if (frontend->sql_log_path) {
|
||||||
srv->sql_mgr->sql_log_path = g_strdup(frontend->sql_log_path);
|
srv->sql_mgr->sql_log_path = g_strdup(frontend->sql_log_path);
|
||||||
} else if(frontend->base_dir) {
|
} else if(frontend->base_dir) {
|
||||||
srv->sql_mgr->sql_log_path = g_strdup(frontend->base_dir);
|
srv->sql_mgr->sql_log_path = g_strdup_printf("%s/logs", frontend->base_dir);
|
||||||
}
|
}
|
||||||
if (frontend->sql_log_maxsize >= 0) {
|
if (frontend->sql_log_maxsize >= 0) {
|
||||||
srv->sql_mgr->sql_log_maxsize = frontend->sql_log_maxsize;
|
srv->sql_mgr->sql_log_maxsize = frontend->sql_log_maxsize;
|
||||||
|
Loading…
Reference in New Issue
Block a user