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 */
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Write timestamp with at most <timestamp_len> characters
|
||||
* to wp.
|
||||
@ -1511,7 +1514,7 @@ return_unregister:
|
||||
|
||||
logmanager_unregister();
|
||||
|
||||
return_err:
|
||||
return_err:
|
||||
|
||||
return err;
|
||||
}
|
||||
@ -1848,10 +1851,9 @@ static char* fname_conf_get_suffix(
|
||||
*
|
||||
*
|
||||
* Parameters:
|
||||
* @param lm - <usage>
|
||||
* <description>
|
||||
* @param lm Log manager pointer
|
||||
*
|
||||
* @return
|
||||
* @return succp true if succeed, otherwise false.
|
||||
*
|
||||
*
|
||||
* @details If logfile is supposed to be located to shared memory
|
||||
@ -1871,6 +1873,7 @@ static bool logfiles_init(
|
||||
bool store_shmem;
|
||||
bool write_syslog;
|
||||
|
||||
/** Open syslog immediately. Print pid of loggind process. */
|
||||
if (syslog_id_str != NULL)
|
||||
{
|
||||
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.
|
||||
*
|
||||
* Parameters:
|
||||
* @param logfile - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @param logfile_id - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @param logmanager - <usage>
|
||||
* <description>
|
||||
*
|
||||
* @param store_shmem - <usage>
|
||||
* <description>
|
||||
* @param logfile log file
|
||||
* @param logfile_id identifier for log file
|
||||
* @param logmanager log manager pointer
|
||||
* @param store_shmem flag to indicate whether log is physically written to shmem
|
||||
* @param write_syslog flag to indicate whether log is also written to syslog
|
||||
*
|
||||
* @return true if succeed, false otherwise
|
||||
*
|
||||
*
|
||||
*/
|
||||
static bool logfile_init(
|
||||
logfile_t* logfile,
|
||||
|
@ -122,8 +122,6 @@ void skygw_log_sync_all(void);
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
void writebuf_clear(void* data);
|
||||
|
||||
const char* get_trace_prefix_default(void);
|
||||
const char* get_trace_suffix_default(void);
|
||||
const char* get_msg_prefix_default(void);
|
||||
|
@ -1531,7 +1531,7 @@ int main(int argc, char **argv)
|
||||
free(log_context);
|
||||
}
|
||||
|
||||
/*<
|
||||
/**
|
||||
* Init Log Manager for MaxScale.
|
||||
* 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
|
||||
@ -1542,22 +1542,27 @@ int main(int argc, char **argv)
|
||||
char buf[1024];
|
||||
char *argv[8];
|
||||
bool succp;
|
||||
|
||||
/** Set log directory under $MAXSCALE_HOME/log */
|
||||
sprintf(buf, "%s/log", home_dir);
|
||||
if(mkdir(buf, 0777) != 0){
|
||||
|
||||
if(errno != EEXIST){
|
||||
if(mkdir(buf, 0777) != 0)
|
||||
{
|
||||
if(errno != EEXIST)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Error: Cannot create log directory: %s\n",buf);
|
||||
"Error: Cannot create log directory: %s\n",
|
||||
buf);
|
||||
goto return_main;
|
||||
}
|
||||
}
|
||||
argv[0] = "MaxScale";
|
||||
argv[1] = "-j";
|
||||
argv[2] = buf;
|
||||
|
||||
if (logtofile)
|
||||
{
|
||||
argv[3] = "-l"; /*< write to syslog */
|
||||
/** Logs that should be syslogged */
|
||||
argv[4] = "LOGFILE_MESSAGE,LOGFILE_ERROR"
|
||||
"LOGFILE_DEBUG,LOGFILE_TRACE";
|
||||
argv[5] = NULL;
|
||||
@ -1566,9 +1571,9 @@ int main(int argc, char **argv)
|
||||
else
|
||||
{
|
||||
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[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< ..these logs to syslog */
|
||||
argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< to syslog */
|
||||
argv[7] = NULL;
|
||||
succp = skygw_logmanager_init(7, argv);
|
||||
}
|
||||
@ -1579,8 +1584,7 @@ int main(int argc, char **argv)
|
||||
goto return_main;
|
||||
}
|
||||
}
|
||||
|
||||
/*<
|
||||
/**
|
||||
* Resolve the full pathname for configuration file and check for
|
||||
* read accessibility.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user