The Error Log is populated with start and stop information, and critical events encountered by the server.
The following is an example of its contents:
The variable log_error
holds the path to the log file for error logging.
In the absence of a configuration file entry for log_error
, the system will default its values to @@hostname
.err in the datadir
. Note that log_error
is not a dynamic variable. As such, changes are done through a cnf or ini file changes and a server restart (or by seeing "Flushing and Renaming the Error Log File" in the Manual Page link at the bottom here).
Logging cannot be disabled for errors. They are important for system health while troubleshooting problems. Also, entries are infrequent compared to the General Query Log.
The GLOBAL variable log_warnings
sets the level for verbosity which varies by server version. The following snippet illustrates:
SELECT @@log_warnings; -- make a note of your prior setting
SET GLOBAL log_warnings=2; -- setting above 1 increases output (see server version)
log_warnings
as seen above is a dynamic variable.
Configuration file changes in cnf
and ini
files might look like the following.
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
MySQL 5.7.2 expanded the warning level verbosity to 3 and added the GLOBAL log_error_verbosity
. Again, it was introduced in 5.7.2. It can be set dynamically and checked as a variable or set via cnf
or ini
configuration file settings.
As of MySQL 5.7.2:
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
log_error_verbosity = 3
Please see the MySQL Manual Page entitled The Error Log especially for Flushing and Renaming the Error Log file, and its Error Log Verbosity section with versions related to log_warnings
and error_log_verbosity
.