Added stdout as an option for log output with the -l or --log command line option.
This commit is contained in:
parent
fc7072786b
commit
dcd0098823
@ -48,9 +48,9 @@ Options may be passed to the MaxScale binary that alter this default behavior, t
|
||||
<td>Use the filename passed as an argument instead of looking in $MAXSCALE_HOME/etc/MaxScale.cnf</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-l<file>|<shm></td>
|
||||
<td>-l<file>|<shm>|<stdout></td>
|
||||
<td>--log=</td>
|
||||
<td>Control where logs are written for the debug and trace level log messages. the default is to write these to a shared memory device, however using the -lfile or --log=file option will forced these to be written to regular files.</td>
|
||||
<td>Control where logs are written for the debug and trace level log messages. the default is to write these to a shared memory device, however using the -lfile or --log=file option will forced these to be written to regular files. Using -lstdout or --log=stdout will use the standard output for all enabled logs.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>-v</td>
|
||||
|
@ -1686,7 +1686,8 @@ static bool fnames_conf_init(
|
||||
"-j <log path> ............(\"/tmp\")\n"
|
||||
"-l <syslog log file ids> .......(no default)\n"
|
||||
"-m <syslog ident> ............(argv[0])\n"
|
||||
"-s <shmem log file ids> .......(no default)\n";
|
||||
"-s <shmem log file ids> .......(no default)\n"
|
||||
"-o .......(write logs to stdout)\n";
|
||||
|
||||
/**
|
||||
* When init_started is set, clean must be done for it.
|
||||
|
@ -996,8 +996,8 @@ static void usage(void)
|
||||
" -c|--homedir=... relative|absolute MaxScale home directory\n"
|
||||
" -f|--config=... relative|absolute pathname of MaxScale configuration file\n"
|
||||
" (default: $MAXSCALE_HOME/etc/MaxScale.cnf)\n"
|
||||
" -l|--log=... log to file or shared memory\n"
|
||||
" -lfile or -lshm - defaults to shared memory\n"
|
||||
" -l|--log=... log to file shared memory or stdout\n"
|
||||
" -lfile, -lshm or -lstdout - defaults to shared memory\n"
|
||||
" -s|--syslog= log messages to syslog."
|
||||
" True or false - defaults to true\n"
|
||||
" -S|--maxscalelog= log messages to MaxScale log."
|
||||
@ -1064,6 +1064,7 @@ int main(int argc, char **argv)
|
||||
void* log_flush_thr = NULL;
|
||||
int option_index;
|
||||
int logtofile = 0; /* Use shared memory or file */
|
||||
int logtostdout = 0; /* Use stdout for log output */
|
||||
int syslog_enabled = 1; /** Log to syslog */
|
||||
int maxscalelog_enabled = 1; /** Log with MaxScale */
|
||||
ssize_t log_flush_timeout_ms = 0;
|
||||
@ -1198,6 +1199,8 @@ int main(int argc, char **argv)
|
||||
logtofile = 1;
|
||||
else if (strncasecmp(optarg, "shm", PATH_MAX) == 0)
|
||||
logtofile = 0;
|
||||
else if (strncasecmp(optarg, "stdout", PATH_MAX) == 0)
|
||||
logtostdout = 1;
|
||||
else
|
||||
{
|
||||
char* logerr = "Configuration file argument "
|
||||
@ -1575,7 +1578,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
{
|
||||
char buf[1024];
|
||||
char *argv[8];
|
||||
char *argv[9];
|
||||
bool succp;
|
||||
/** Set log directory under $MAXSCALE_HOME/log */
|
||||
sprintf(buf, "%s/log", home_dir);
|
||||
@ -1605,8 +1608,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
logmanager_enable_syslog(syslog_enabled);
|
||||
logmanager_enable_maxscalelog(maxscalelog_enabled);
|
||||
|
||||
if (logtofile)
|
||||
if (logtostdout)
|
||||
{
|
||||
argv[3] = "-s"; /*< store to shared memory */
|
||||
argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /*< to shm */
|
||||
argv[5] = "-l"; /*< write to syslog */
|
||||
argv[6] = "LOGFILE_MESSAGE,LOGFILE_ERROR"; /*< to syslog */
|
||||
argv[7] = "-o";
|
||||
argv[8] = NULL;
|
||||
succp = skygw_logmanager_init(8, argv);
|
||||
}
|
||||
else if (logtofile)
|
||||
{
|
||||
argv[3] = "-l"; /*< write to syslog */
|
||||
/** Logs that should be syslogged */
|
||||
|
Loading…
x
Reference in New Issue
Block a user