All pages
Powered by GitBook
1 of 1

Loading...

Error Log

The error log contains a record of critical errors that occurred during the server's operation, table corruption, start and stop information.

SQL errors can also be logged in a separate file using the SQL_ERROR_LOG plugin.

Configuring the Error Log Output Destination

MariaDB always writes its error log, but the destination is configurable.

Writing the Error Log to a File

To configure the error log to be written to a file, you can set the system variable. You can configure a specific file name. However, if a specific file name is not configured, the log will be written to the ${hostname}.err file in the directory by default.

The system variable can be set in a server in an prior to starting up the server. For example, to write the error log to the default ${hostname}.err file, you could configure the following:

If you configure a specific file name as the system variable, and if it is not an absolute path, then it will be relative to the directory. For example, if you configured the following, then the error log would be written to mariadb.err in the directory:

If it is a relative path, then the is relative to the directory.

However, the system variable can also be an absolute path:

Another way to configure the error log file name is to set the option, which configures MariaDB to use a common prefix for all log files (e.g. , , error log, , etc.). The error log file name will be built by adding a .err extension to this prefix. For example, if you configured the following, then the error log would still be written to mariadb.err in the directory:

The cannot be an absolute path. The log file name is relative to the directory.

Writing the Error Log to Stderr on Unix

On Unix, if the system variable is not set, errors are written to stderr, which usually means that the log messages are output to the terminal that started mariadbd.

If the system variable was set in an or on the command-line, it can still be unset by specifying --skip-log-error.

Writing the Error Log to Syslog on Unix

On Unix, the error log can also be redirected to the . How this is done depends on how you MariaDB.

Syslog with mariadbd-safe

If you MariaDB with , the error log can be redirected to the syslog. See for more information.

Syslog with Systemd

If you MariaDB with , the error log can also be redirected to the syslog. See for more information.

also has its own logging system called the journal, and some errors may get logged there instead. See for more information.

Writing the Error Log to Console on Windows

On Windows, if the option is specified, and if the system variable is not used, errors are written to the console. If both options are specified, the last option takes precedence.

Writing the Error Log to the Windows Event Viewer

On Windows, error log messages are also written to the Windows Event Viewer. You can find MariaDB's error log messages by browsing Windows Logs, then selecting Application or Application Log, depending on the Windows version.

You can find MariaDB's error log messages by searching for the Source MariaDB (prior to , this was MySQL).

Finding the Error Log

To find where the error log is stored, one can find the options used for the error log with:

or (from )

or

If the above don't help, check also if your system is set to , in which case you need to use to access it.

Configuring the Error Log Verbosity

The default value of the system variable is 2.

The system variable can be used to configure the verbosity of the error log. It can be changed dynamically with . For example:

It can also be set either on the command-line or in a server in an prior to starting up the server. For example:

Some of the warnings included in each verbosity level are described below.

The system variable only has an effect on some log messages. Some log messages are always written to the error log, regardless of the error log verbosity. For example, most warnings from the InnoDB storage engine are not affected by . For a complete list of log messages affected by , see the description of the system variable.

Verbosity Level 0

If is 0, many optional warnings will not be logged. However, this does not prevent all warnings from being logged, because there are certain core warnings that will always be written to the error log. For example:

  • If is disabled, and if DDL is performed on a table that triggers a , InnoDB logs a warning:

However, if is enabled, the same message will be logged as an error.

Verbosity Level 1

Default until . If is 1, many types of warnings are logged. Some useful warnings are:

  • Replication-related messages:

  • Messages related to DNS lookup failures:

  • Messages related to the :

  • Messages related to :

Frequent warnings about can cause the error log to grow very large. MariaDB will automatically detect frequent duplicate warnings about . After 10 identical warnings are detected, MariaDB will prevent that same warning from being written to the error log again for the next 5 minutes.

Verbosity Level 2

Default from . If is 2, a couple other different kinds of warnings are printed. For example:

  • Messages related to access denied errors:

  • Messages related to connections that are aborted due to errors or timeouts:

  • Messages related to table handler errors:

  • Messages related to the files used to :

    • Either the default master.info file or the file that is configured by the option.

    • Either the default relay-log.info file or the file that is configured by the system variable.

  • Messages about a master's :

Verbosity Level 3

If is 3, a couple other different kinds of warnings are printed. For example:

  • Messages related to old-style language options:

  • Messages related to :

Verbosity Level 4

If is 4, a couple other different kinds of warnings are printed. For example:

  • Messages related to killed connections:

  • Messages related to all closed connections:

  • Messages related to released connections, such as when a transaction is committed and is set to RELEASE:

Verbosity Level 9

If is 9, some very verbose warnings are printed. For example:

  • Messages about initializing plugins:

MySQL's log_error_verbosity

MariaDB does not support the system variable added in MySQL 5.7.

Format

The error log begins with a line indicating where the data is being read from, for example:

Then, each item (note, warning or error) consists of a single line, containing the date (yyyy-mm-dd) and time, the thread ID, followed by the type of error (Note, Warning or Error) and the error message, for example:

Until , the format only consisted of the date (yymmdd) and time, followed by the type of error (Note, Warning or Error) and the error message, for example:

The first item will always contain the source revision, a unique server id (from , , , , , , , ) and the process_id, for example:

or

Rotating the Error Log on Unix and Linux

Unix and Linux distributions offer the utility, which makes it very easy to rotate log files. See for more information on how to use this utility to rotate the error log.

Error Messages File

Many error messages are read from an error message file that contains localized error messages. If the server can't find this file when it starts up, you might see errors like the following:

If this error is occurring because the file is in a custom location, you can configure this location by setting the system variable either on the command-line or in a server in an prior to starting up the server:

If you want to use a different locale for error messages, you can also set the system variable:

See for more information.

See Also

This page is licensed: CC BY-SA / Gnu FDL

log_error
datadir
log_error
option group
option file
log_error
datadir
datadir
log_error
datadir
log_error
log-basename
general query log
slow query log
binary logs
datadir
log-basename
datadir
log_error
log_error
option file
syslog
start
start
mariadbd-safe
mariadbd-safe: Configuring MariaDB to Write the Error Log to Syslog
start
systemd
Systemd: Configuring MariaDB to Write the Error Log to Syslog
systemd
Systemd:Systemd Journal
console
log_error
write to syslog
journalctl
log_warnings
log_warnings
SET GLOBAL
option group
option file
log_warnings
log_warnings
log_warnings
log_warnings
log_warnings
InnoDB strict mode
"Row size too large" error
InnoDB strict mode
log_warnings
event scheduler
unsafe statements for statement-based replication
unsafe statements for statement-based replication
unsafe statements for statement-based replication
log_warnings
persist replication state
master_info_file
relay_log_info_file
binary log dump thread
log_warnings
progress of InnoDB online DDL
log_warnings
completion_type
log_warnings
log_error_verbosity
logrotate
Rotating Logs on Unix and Linux
lc_messages_dir
option group
option file
lc_messages
Setting the Language for Error Messages
sql error log plugin
[mariadb]
...
log_error
[mariadb]
...
log_error=mariadb.err
[mariadb]
...
log_error=/var/log/mysql/mariadb.err
[mariadb]
...
log-basename=mariadb
log_error
mariadbd --print-defaults
my_print_defaults --mariadbd | grep log-error
my_print_defaults --mysqld | grep log-error
SET GLOBAL log_warnings=3;
[mariadb]
...
log_warnings=3
[Warning] InnoDB: Cannot add field col25 in table db1.tab because after 
  adding it, the row size is 8477 which is greater than maximum allowed 
  size (8126) for a record on index leaf page.
[Note] Error reading relay log event: slave SQL thread was killed
[Note] Slave SQL thread exiting, replication stopped in log 
  'dbserver-2-bin.000033'   at position 181420; 
  GTID position '0-263316466-368886'
[Note] Slave I/O thread exiting, read up to log 
  'dbserver-2-bin.000034', position 642; 
  GTID position 0-263316466-368887
[Warning] IP address '192.168.1.193' 
  could not be resolved: Name or service not known
[Note] Event Scheduler: Loaded 0 events
[Warning] Unsafe statement written to the binary log using statement format since 
  BINLOG_FORMAT = STATEMENT. The statement is unsafe because 
  it uses a LIMIT clause. This 
  is unsafe because the set of rows included cannot be predicted.
[Warning] Access denied for user 'root'@'localhost' (using password: YES)
[Warning] Aborted connection 35 to db: 'unconnected' user: 
  'user1@host1' host: '192.168.1.40' (Got an error writing communication packets)
[Warning] Aborted connection 36 to db: 'unconnected' user: 
  'user1@host2' host: '192.168.1.230' (Got an error writing communication packets)
[Warning] Aborted connection 38 to db: 'db1' user: 
  'user2' host: '192.168.1.60' (Unknown error) 
[Warning] Aborted connection 51 to db: 'db1' user: 
  'user2' host: '192.168.1.50' (Got an error reading communication packets)
[Warning] Aborted connection 52 to db: 'db1' user: 
  'user3' host: '192.168.1.53' (Got timeout reading communication packets)
[Warning] Can't find record in 'tab1'.
[Warning] Can't write; duplicate key in table 'tab1'.
[Warning] Lock wait timeout exceeded; try restarting transaction.
[Warning] The number of locks exceeds the lock table size.
[Warning] Update locks cannot be acquired during a READ UNCOMMITTED transaction.
[Note] Reading Master_info: '/mariadb/data/master.info'  
  Relay_info:'/mariadb/data/relay-log.info'
[Note] Initialized Master_info from '/mariadb/data/master.info'
[Note] Reading of all Master_info entries succeded
[Note] Deleted Master_info file '/mariadb/data/master.info'.
[Note] Deleted Master_info file '/mariadb/data/relay-log.info'.
[Note] Start binlog_dump to slave_server(263316466), pos(, 4)
[Warning] An old style --language value with language specific 
  part detected: /usr/local/mysql/data/
[Warning] Use --lc-messages-dir without language specific part instead.
[Note] InnoDB: Online DDL : Start
[Note] InnoDB: Online DDL : Start reading clustered index of the table and 
  create temporary files
[Note] InnoDB: Online DDL : End of reading clustered index of the table and 
  create temporary files
[Note] InnoDB: Online DDL : Start merge-sorting index PRIMARY (1 / 3), 
  estimated cost : 18.0263
[Note] InnoDB: Online DDL : merge-sorting has estimated 33 runs
[Note] InnoDB: Online DDL : merge-sorting current run 1 estimated 33 runs
[Note] InnoDB: Online DDL : merge-sorting current run 2 estimated 17 runs
[Note] InnoDB: Online DDL : merge-sorting current run 3 estimated 9 runs
[Note] InnoDB: Online DDL : merge-sorting current run 4 estimated 5 runs
[Note] InnoDB: Online DDL : merge-sorting current run 5 estimated 3 runs
[Note] InnoDB: Online DDL : merge-sorting current run 6 estimated 2 runs
[Note] InnoDB: Online DDL : End of  merge-sorting index PRIMARY (1 / 3)
[Note] InnoDB: Online DDL : Start building index PRIMARY (1 / 3), 
  estimated cost : 27.0395
[Note] InnoDB: Online DDL : End of building index PRIMARY (1 / 3)
[Note] InnoDB: Online DDL : Completed
[Note] InnoDB: Online DDL : Start merge-sorting index ux1 (2 / 3), 
  estimated cost : 5.7895
[Note] InnoDB: Online DDL : merge-sorting has estimated 2 runs
[Note] InnoDB: Online DDL : merge-sorting current run 1 estimated 2 runs
[Note] InnoDB: Online DDL : End of  merge-sorting index ux1 (2 / 3)
[Note] InnoDB: Online DDL : Start building index ux1 (2 / 3), 
  estimated cost : 8.6842
[Note] InnoDB: Online DDL : End of building index ux1 (2 / 3)
[Note] InnoDB: Online DDL : Completed
[Note] InnoDB: Online DDL : Start merge-sorting index ix1 (3 / 3), 
  estimated cost : 6.1842
[Note] InnoDB: Online DDL : merge-sorting has estimated 3 runs
[Note] InnoDB: Online DDL : merge-sorting current run 1 estimated 3 runs
[Note] InnoDB: Online DDL : merge-sorting current run 2 estimated 2 runs
[Note] InnoDB: Online DDL : End of  merge-sorting index ix1 (3 / 3)
[Note] InnoDB: Online DDL : Start building index ix1 (3 / 3), 
  estimated cost : 9.2763
[Note] InnoDB: Online DDL : End of building index ix1 (3 / 3)
[Note] InnoDB: Online DDL : Completed
[Warning] Aborted connection 53 to db: 'db1' user: 
  'user2' host: '192.168.1.50' (KILLED)
[Warning] Aborted connection 56 to db: 'db1' user: 
  'user2' host: '192.168.1.50' (CLOSE_CONNECTION)
[Warning] Aborted connection 58 to db: 'db1' user: 
  'user2' host: '192.168.1.50' (RELEASE)
[Note] Initializing built-in plugins
[Note] Initializing plugins specified on the command line
[Note] Initializing installed plugins
240919 22:58:50 mysqld_safe Starting mariadbd daemon with databases from /home/ian/sandboxes/msb_11_7_0/data
2016-06-15 16:53:33 139651251140544 [Note] InnoDB: The InnoDB memory heap is disabled
160615 16:53:08 [Note] InnoDB: The InnoDB memory heap is disabled
2024-09-19 22:58:50 0 [Note] Starting MariaDB 11.7.0-preview-MariaDB source revision 
  7391f7143b462b29ecdaee049c5ebdfd1aefa6d7 server_uid UdJQ5BCzAQiTopMoCz3yYsfU1lA= 
  as process 2307166
2024-05-18 16:05:33 0 [Note] Starting MariaDB 10.11.8-MariaDB source revision 
  3a069644682e336e445039e48baae9693f9a08ee as process 50774
[ERROR] Can't find messagefile '/usr/share/errmsg.sys'
[mariadb]
...
lc_messages_dir=/usr/share/mysql/
[mariadb]
...
lc_messages_dir=/usr/share/mysql/
lc_messages=en_US
MariaDB 10.4
MariaDB 10.11
MariaDB 10.2.3
MariaDB 10.2.4
MariaDB 10.1.4
MariaDB 10.5.26
MariaDB 10.6.19
MariaDB 10.11.9
MariaDB 11.1.6
MariaDB 11.2.5
MariaDB 11.4.3
MariaDB 11.5.2
MariaDB 11.6.1