Allow [en|dis]abling of [sys|maxscale]log via maxadmin.

The syslog and maxscalelog can now be enabled and disabled at
runtime using maxadmin.
This commit is contained in:
Johan Wikman 2015-11-24 21:34:23 +02:00
parent 51e41bb2e3
commit af6ec7f346
2 changed files with 78 additions and 0 deletions

View File

@ -2420,6 +2420,8 @@ void flushall_logfiles(bool flush)
void mxs_log_set_highprecision_enabled(bool enabled)
{
log_config.do_highprecision = enabled;
MXS_NOTICE("highprecision logging is %s.", enabled ? "enabled" : "disabled");
}
/**
@ -2430,6 +2432,8 @@ void mxs_log_set_highprecision_enabled(bool enabled)
void mxs_log_set_syslog_enabled(bool enabled)
{
log_config.do_syslog = enabled;
MXS_NOTICE("syslog logging is %s.", enabled ? "enabled" : "disabled");
}
/**
@ -2440,6 +2444,8 @@ void mxs_log_set_syslog_enabled(bool enabled)
void mxs_log_set_maxscalelog_enabled(bool enabled)
{
log_config.do_maxscalelog = enabled;
MXS_NOTICE("maxscalelog logging is %s.", enabled ? "enabled" : "disabled");
}

View File

@ -427,6 +427,10 @@ static void enable_service_root(DCB *dcb, SERVICE *service);
static void disable_service_root(DCB *dcb, SERVICE *service);
static void enable_feedback_action();
static void disable_feedback_action();
static void enable_syslog();
static void disable_syslog();
static void enable_maxscalelog();
static void disable_maxscalelog();
/**
* * The subcommands of the enable command
@ -498,6 +502,22 @@ struct subcommand enableoptions[] = {
"Enable MaxScale modules list sending via http to notification service",
{0, 0, 0}
},
{
"syslog",
0,
enable_syslog,
"Enable syslog logging",
"Enable syslog logging",
{0, 0, 0}
},
{
"maxscalelog",
0,
enable_maxscalelog,
"Enable maxscalelog logging",
"Enable maxscalelog logging",
{0, 0, 0}
},
{
NULL,
0,
@ -580,6 +600,22 @@ struct subcommand disableoptions[] = {
"Disable MaxScale modules list sending via http to notification service",
{0, 0, 0}
},
{
"syslog",
0,
disable_syslog,
"Disable syslog logging",
"Disable syslog logging",
{0, 0, 0}
},
{
"maxscalelog",
0,
disable_maxscalelog,
"Disable maxscalelog logging",
"Disable maxscalelog logging",
{0, 0, 0}
},
{
NULL,
0,
@ -1750,6 +1786,42 @@ disable_feedback_action(void)
return;
}
/**
* Enable syslog logging.
*/
static void
enable_syslog()
{
mxs_log_set_syslog_enabled(true);
}
/**
* Disable syslog logging.
*/
static void
disable_syslog()
{
mxs_log_set_syslog_enabled(false);
}
/**
* Enable maxscalelog logging.
*/
static void
enable_maxscalelog()
{
mxs_log_set_maxscalelog_enabled(true);
}
/**
* Disable maxscalelog logging.
*/
static void
disable_maxscalelog()
{
mxs_log_set_maxscalelog_enabled(false);
}
#if defined(FAKE_CODE)
static void fail_backendfd(void)
{