Added comments, removed non-existing function, cleaned up a bit.
This commit is contained in:
@ -684,7 +684,11 @@ static int logmanager_write_log(
|
|||||||
/** Length of session id */
|
/** Length of session id */
|
||||||
int sesid_str_len;
|
int sesid_str_len;
|
||||||
|
|
||||||
/** 2 braces, 2 spaces and terminating char */
|
/**
|
||||||
|
* 2 braces, 2 spaces and terminating char
|
||||||
|
* If session id is stored to tls_log_info structure, allocate
|
||||||
|
* room for session id too.
|
||||||
|
*/
|
||||||
if (id == LOGFILE_TRACE && tls_log_info.li_sesid != 0)
|
if (id == LOGFILE_TRACE && tls_log_info.li_sesid != 0)
|
||||||
{
|
{
|
||||||
sesid_str_len = 2+2+get_decimal_len(tls_log_info.li_sesid)+1;
|
sesid_str_len = 2+2+get_decimal_len(tls_log_info.li_sesid)+1;
|
||||||
@ -747,7 +751,6 @@ static int logmanager_write_log(
|
|||||||
wp += strlen(wp);
|
wp += strlen(wp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write timestamp with at most <timestamp_len> characters
|
* Write timestamp with at most <timestamp_len> characters
|
||||||
* to wp.
|
* to wp.
|
||||||
@ -1848,10 +1851,9 @@ static char* fname_conf_get_suffix(
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* @param lm - <usage>
|
* @param lm Log manager pointer
|
||||||
* <description>
|
|
||||||
*
|
*
|
||||||
* @return
|
* @return succp true if succeed, otherwise false.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @details If logfile is supposed to be located to shared memory
|
* @details If logfile is supposed to be located to shared memory
|
||||||
@ -1871,6 +1873,7 @@ static bool logfiles_init(
|
|||||||
bool store_shmem;
|
bool store_shmem;
|
||||||
bool write_syslog;
|
bool write_syslog;
|
||||||
|
|
||||||
|
/** Open syslog immediately. Print pid of loggind process. */
|
||||||
if (syslog_id_str != NULL)
|
if (syslog_id_str != NULL)
|
||||||
{
|
{
|
||||||
openlog(syslog_ident_str, LOG_PID | LOG_NDELAY, LOG_USER);
|
openlog(syslog_ident_str, LOG_PID | LOG_NDELAY, LOG_USER);
|
||||||
@ -2483,21 +2486,13 @@ static bool file_is_symlink(
|
|||||||
* link name. Create block buffer for logfile.
|
* link name. Create block buffer for logfile.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* @param logfile - <usage>
|
* @param logfile log file
|
||||||
* <description>
|
* @param logfile_id identifier for log file
|
||||||
*
|
* @param logmanager log manager pointer
|
||||||
* @param logfile_id - <usage>
|
* @param store_shmem flag to indicate whether log is physically written to shmem
|
||||||
* <description>
|
* @param write_syslog flag to indicate whether log is also written to syslog
|
||||||
*
|
|
||||||
* @param logmanager - <usage>
|
|
||||||
* <description>
|
|
||||||
*
|
|
||||||
* @param store_shmem - <usage>
|
|
||||||
* <description>
|
|
||||||
*
|
*
|
||||||
* @return true if succeed, false otherwise
|
* @return true if succeed, false otherwise
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static bool logfile_init(
|
static bool logfile_init(
|
||||||
logfile_t* logfile,
|
logfile_t* logfile,
|
||||||
|
|||||||
@ -122,8 +122,6 @@ void skygw_log_sync_all(void);
|
|||||||
|
|
||||||
EXTERN_C_BLOCK_END
|
EXTERN_C_BLOCK_END
|
||||||
|
|
||||||
void writebuf_clear(void* data);
|
|
||||||
|
|
||||||
const char* get_trace_prefix_default(void);
|
const char* get_trace_prefix_default(void);
|
||||||
const char* get_trace_suffix_default(void);
|
const char* get_trace_suffix_default(void);
|
||||||
const char* get_msg_prefix_default(void);
|
const char* get_msg_prefix_default(void);
|
||||||
|
|||||||
@ -1531,7 +1531,7 @@ int main(int argc, char **argv)
|
|||||||
free(log_context);
|
free(log_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*<
|
/**
|
||||||
* Init Log Manager for MaxScale.
|
* Init Log Manager for MaxScale.
|
||||||
* If $MAXSCALE_HOME is set then write the logs into $MAXSCALE_HOME/log.
|
* If $MAXSCALE_HOME is set then write the logs into $MAXSCALE_HOME/log.
|
||||||
* The skygw_logmanager_init expects to take arguments as passed to main
|
* The skygw_logmanager_init expects to take arguments as passed to main
|
||||||
@ -1542,22 +1542,27 @@ int main(int argc, char **argv)
|
|||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *argv[8];
|
char *argv[8];
|
||||||
bool succp;
|
bool succp;
|
||||||
|
/** Set log directory under $MAXSCALE_HOME/log */
|
||||||
sprintf(buf, "%s/log", home_dir);
|
sprintf(buf, "%s/log", home_dir);
|
||||||
if(mkdir(buf, 0777) != 0){
|
|
||||||
|
|
||||||
if(errno != EEXIST){
|
if(mkdir(buf, 0777) != 0)
|
||||||
|
{
|
||||||
|
if(errno != EEXIST)
|
||||||
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Error: Cannot create log directory: %s\n",buf);
|
"Error: Cannot create log directory: %s\n",
|
||||||
|
buf);
|
||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
argv[0] = "MaxScale";
|
argv[0] = "MaxScale";
|
||||||
argv[1] = "-j";
|
argv[1] = "-j";
|
||||||
argv[2] = buf;
|
argv[2] = buf;
|
||||||
|
|
||||||
if (logtofile)
|
if (logtofile)
|
||||||
{
|
{
|
||||||
argv[3] = "-l"; /*< write to syslog */
|
argv[3] = "-l"; /*< write to syslog */
|
||||||
|
/** Logs that should be syslogged */
|
||||||
argv[4] = "LOGFILE_MESSAGE,LOGFILE_ERROR"
|
argv[4] = "LOGFILE_MESSAGE,LOGFILE_ERROR"
|
||||||
"LOGFILE_DEBUG,LOGFILE_TRACE";
|
"LOGFILE_DEBUG,LOGFILE_TRACE";
|
||||||
argv[5] = NULL;
|
argv[5] = NULL;
|
||||||
@ -1566,9 +1571,9 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
argv[3] = "-s"; /*< store to shared memory */
|
argv[3] = "-s"; /*< store to shared memory */
|
||||||
argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /*< ..these logs to shm */
|
argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /*< to shm */
|
||||||
argv[5] = "-l"; /*< write to syslog */
|
argv[5] = "-l"; /*< write to syslog */
|
||||||
argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< ..these logs to syslog */
|
argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< to syslog */
|
||||||
argv[7] = NULL;
|
argv[7] = NULL;
|
||||||
succp = skygw_logmanager_init(7, argv);
|
succp = skygw_logmanager_init(7, argv);
|
||||||
}
|
}
|
||||||
@ -1579,8 +1584,7 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
/*<
|
|
||||||
* Resolve the full pathname for configuration file and check for
|
* Resolve the full pathname for configuration file and check for
|
||||||
* read accessibility.
|
* read accessibility.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user