diff --git a/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result b/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result index 649d91269b6..4d869da5fd8 100644 --- a/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result +++ b/mysql-test/suite/plugins/r/sql_error_log_withdbinfo.result @@ -28,10 +28,10 @@ CREATE DATABASE `NULL`; USE `NULL`; DROP DATABASE db; ERROR HY000: Can't drop database 'db'; database doesn't exist -THREAD_ID `test` TIME HOSTNAME ERROR 1238: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable : SET sql_error_log_with_db_and_thread_info=OFF -THREAD_ID `test` TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db -THREAD_ID NULL TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db -THREAD_ID `NULL` TIME HOSTNAME ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db +TIME THREAD_ID HOSTNAME `test` ERROR 1238: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable : SET sql_error_log_with_db_and_thread_info=OFF +TIME THREAD_ID HOSTNAME `test` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db +TIME THREAD_ID HOSTNAME NULL ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db +TIME THREAD_ID HOSTNAME `NULL` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db DROP DATABASE `NULL`; # Reset CREATE DATABASE test; diff --git a/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test index bddcc14e275..c28fe793805 100644 --- a/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test +++ b/mysql-test/suite/plugins/t/sql_error_log_withdbinfo.test @@ -40,7 +40,7 @@ DROP DATABASE db; --let SEARCH_FILE= $MYSQLD_DATADIR/sql_errors.log --let LINES_TO_READ=4 ---replace_regex /[1-9]* `NULL` [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID `NULL` TIME HOSTNAME / /[1-9]* `test` [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID `test` TIME HOSTNAME / /[1-9]* NULL [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID NULL TIME HOSTNAME / +--replace_regex /[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `test` /TIME THREAD_ID HOSTNAME `test` //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* NULL /TIME THREAD_ID HOSTNAME NULL //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `NULL` /TIME THREAD_ID HOSTNAME `NULL` / --source include/read_head.inc DROP DATABASE `NULL`; diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c index a3f36fc966e..d668ed8779b 100644 --- a/plugin/sql_errlog/sql_errlog.c +++ b/plugin/sql_errlog/sql_errlog.c @@ -107,21 +107,19 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)), { if (event->database.str) { - logger_printf(logfile, "%llu %`s %04d-%02d-%02d %2d:%02d:%02d " - "%s ERROR %d: %s : %s \n", - event->general_thread_id, event->database.str, 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); + logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d %llu " + "%s %`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_thread_id, event->general_user, event->database.str, + event->general_error_code, event->general_command, event->general_query); } else { - logger_printf(logfile, "%llu %s %04d-%02d-%02d %2d:%02d:%02d " - "%s ERROR %d: %s : %s \n", - event->general_thread_id, "NULL", 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); + logger_printf(logfile, "%04d-%02d-%02d %2d:%02d:%02d %llu " + "%s %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_thread_id, event->general_user, "NULL", + event->general_error_code, event->general_command, event->general_query); } } else