1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

MDEV-7389 Request: log warnings into SQL_ERROR_LOG

Changes:
- Audit_null records and displays warning count
- sql_error_log prints warnings

Reviewer: Alexey Botchkov <holyfoot@askmonty.org>
This commit is contained in:
Monty
2023-05-23 15:32:50 +03:00
parent 7c9f275ee4
commit e9fe39d566
9 changed files with 71 additions and 19 deletions

View File

@@ -84,8 +84,11 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)),
const struct mysql_event_general *event =
(const struct mysql_event_general*)ev;
if (rate &&
event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR)
(event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ||
event->event_subclass == MYSQL_AUDIT_GENERAL_WARNING))
{
const char *type= (event->event_subclass == MYSQL_AUDIT_GENERAL_ERROR ?
"ERROR" : "WARNING");
if (++count >= rate)
{
struct tm t;
@@ -94,11 +97,11 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)),
count = 0;
(void) localtime_r(&event_time, &t);
logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d "
"%s ERROR %d: %s : %s\n",
t.tm_year + 1900, t.tm_mon + 1,
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
event->general_user, event->general_error_code,
event->general_command, event->general_query);
"%s %s %d: %s : %s\n",
t.tm_year + 1900, t.tm_mon + 1,
t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
event->general_user, type, event->general_error_code,
event->general_command, event->general_query);
}
}
}