mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Added option sql_error_warnings to sql_error_log plugin
This commit is contained in:
parent
582d0cf5b0
commit
3eab2275d0
2 changed files with 9 additions and 1 deletions
|
@ -8,6 +8,7 @@ sql_error_log_rate 1
|
||||||
sql_error_log_rotate OFF
|
sql_error_log_rotate OFF
|
||||||
sql_error_log_rotations 9
|
sql_error_log_rotations 9
|
||||||
sql_error_log_size_limit 1000000
|
sql_error_log_size_limit 1000000
|
||||||
|
sql_error_log_warnings ON
|
||||||
set global sql_error_log_rate=1;
|
set global sql_error_log_rate=1;
|
||||||
select * from t_doesnt_exist;
|
select * from t_doesnt_exist;
|
||||||
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
|
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist
|
||||||
|
|
|
@ -39,6 +39,7 @@ static unsigned int rate;
|
||||||
static unsigned long long size_limit;
|
static unsigned long long size_limit;
|
||||||
static unsigned int rotations;
|
static unsigned int rotations;
|
||||||
static char rotate;
|
static char rotate;
|
||||||
|
static char warnings;
|
||||||
|
|
||||||
static unsigned int count;
|
static unsigned int count;
|
||||||
LOGGER_HANDLE *logfile;
|
LOGGER_HANDLE *logfile;
|
||||||
|
@ -67,12 +68,18 @@ static MYSQL_SYSVAR_STR(filename, filename,
|
||||||
"The file to log sql errors to", NULL, NULL,
|
"The file to log sql errors to", NULL, NULL,
|
||||||
"sql_errors.log");
|
"sql_errors.log");
|
||||||
|
|
||||||
|
static MYSQL_SYSVAR_BOOL(warnings, warnings,
|
||||||
|
PLUGIN_VAR_OPCMDARG,
|
||||||
|
"Warnings. If set to 0, warnings are not logged.",
|
||||||
|
NULL, NULL, 1);
|
||||||
|
|
||||||
static struct st_mysql_sys_var* vars[] = {
|
static struct st_mysql_sys_var* vars[] = {
|
||||||
MYSQL_SYSVAR(rate),
|
MYSQL_SYSVAR(rate),
|
||||||
MYSQL_SYSVAR(size_limit),
|
MYSQL_SYSVAR(size_limit),
|
||||||
MYSQL_SYSVAR(rotations),
|
MYSQL_SYSVAR(rotations),
|
||||||
MYSQL_SYSVAR(rotate),
|
MYSQL_SYSVAR(rotate),
|
||||||
MYSQL_SYSVAR(filename),
|
MYSQL_SYSVAR(filename),
|
||||||
|
MYSQL_SYSVAR(warnings),
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -85,7 +92,7 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)),
|
||||||
(const struct mysql_event_general*)ev;
|
(const struct mysql_event_general*)ev;
|
||||||
if (rate &&
|
if (rate &&
|
||||||
(event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ||
|
(event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ||
|
||||||
event->event_subclass == MYSQL_AUDIT_GENERAL_WARNING))
|
(warnings && event->event_subclass == MYSQL_AUDIT_GENERAL_WARNING)))
|
||||||
{
|
{
|
||||||
const char *type= (event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ?
|
const char *type= (event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ?
|
||||||
"ERROR" : "WARNING");
|
"ERROR" : "WARNING");
|
||||||
|
|
Loading…
Reference in a new issue