diff options
author | Alexey Botchkov <holyfoot@askmonty.org> | 2012-03-14 16:37:49 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@askmonty.org> | 2012-03-14 16:37:49 +0400 |
commit | e3e2b4e1d15400f8fceb1ea3aa1b2ce1b4897477 (patch) | |
tree | 9883fc54b95bfc3a464aa7142a34c49e366e7c3d /plugin | |
parent | 620d62ac3e74f3e707d3d3745c8172df0989754c (diff) | |
download | mariadb-git-e3e2b4e1d15400f8fceb1ea3aa1b2ce1b4897477.tar.gz |
MDEV-15 Log SQL errors.
mysys/my_logger.c was moved to sql/sql_logger.c
Logger service was rewritten with file functions instead of stream, so it
can handle huge files.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/sql_errlog/sql_errlog.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c index 53d804feeb3..ee2765a7143 100644 --- a/plugin/sql_errlog/sql_errlog.c +++ b/plugin/sql_errlog/sql_errlog.c @@ -18,12 +18,23 @@ #include <time.h> /* + Disable __attribute__() on non-gcc compilers. +*/ +#if !defined(__attribute__) && !defined(__GNUC__) +#define __attribute__(A) +#endif + +#ifdef _WIN32 +#define localtime_r(a, b) localtime_s(b, a) +#endif /*WIN32*/ + +/* rate 0 means the logging was disabled. */ static char *filename; static unsigned int rate; -static unsigned int size_limit; +static unsigned long long size_limit; static unsigned int rotations; static char rotate; @@ -37,9 +48,9 @@ static MYSQL_SYSVAR_UINT(rate, rate, PLUGIN_VAR_RQCMDARG, "Sampling rate. If set to 0(zero), the logging is disabled.", NULL, NULL, 1, 0, 1000000, 1); -static MYSQL_SYSVAR_UINT(size_limit, size_limit, +static MYSQL_SYSVAR_ULONGLONG(size_limit, size_limit, PLUGIN_VAR_READONLY, "Log file size limit", NULL, NULL, - 1000000, 100, 1024*1024L*1024L, 1); + 1000000, 100, 0, 1); static MYSQL_SYSVAR_UINT(rotations, rotations, PLUGIN_VAR_READONLY, "Number of rotations before log is removed.", @@ -79,7 +90,7 @@ static void log_sql_errors(MYSQL_THD thd __attribute__((unused)), time_t event_time = event->general_time; count = 0; - localtime_r(&event_time, &t); + (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, |