Log: Another step in the move from logfiles to priorities.

skygw_[enable|disable]_log has now been removed from the external
interface and priorities must instead be set using
mxs_log_set_priority_enabled(int priority, bool enabled). A bitmask
is already being updated, but internally and as used by the LOG_IF
macros, the actual enabling is still made using logfile ids.

The configuration entries have been replaced as follows:

	log_messages -> log_notice
	log_trace    -> log_info

The old ones can be used, but cause a warning to be logged.

Similarily the maxadmin commands have been updated.
"[enable|disable] log ..." works as expected, but there will be
a message about it being deprecated. Instead there is now a
[enable|disable] log-priority err|warning|notice|info|debug
command that should be used instead.
This commit is contained in:
Johan Wikman
2015-11-13 13:47:10 +02:00
parent 2dcdab29b6
commit bcb918e60b
8 changed files with 238 additions and 238 deletions

View File

@ -1596,12 +1596,16 @@ config_get_feedback_data()
static struct
{
char *logname;
logfile_id_t logfile;
char* name;
int priority;
char* replacement;
} lognames[] = {
{ "log_messages", LOGFILE_MESSAGE },
{ "log_trace", LOGFILE_TRACE },
{ "log_debug", LOGFILE_DEBUG },
{ "log_messages", LOG_NOTICE, "log_notice" }, // Deprecated
{ "log_trace", LOG_INFO, "log_info" }, // Deprecated
{ "log_debug", LOG_DEBUG, NULL },
{ "log_warning", LOG_WARNING, NULL },
{ "log_notice", LOG_NOTICE, NULL },
{ "log_info", LOG_INFO, NULL },
{ NULL, 0 }
};
/**
@ -1681,18 +1685,18 @@ handle_global_item(const char *name, const char *value)
}
else
{
for (i = 0; lognames[i].logname; i++)
for (i = 0; lognames[i].name; i++)
{
if (strcasecmp(name, lognames[i].logname) == 0)
if (strcasecmp(name, lognames[i].name) == 0)
{
if (config_truth_value((char*)value))
if (lognames[i].replacement)
{
skygw_log_enable(lognames[i].logfile);
}
else
{
skygw_log_disable(lognames[i].logfile);
MXS_WARNING("In the configuration file the use of '%s' is deprecated, "
"use '%s' instead.",
lognames[i].name, lognames[i].replacement);
}
mxs_log_set_priority_enabled(lognames[i].priority, config_truth_value((char*)value));
}
}
}