Tuesday, April 23

MySQL server variables log_warnings to log_error_verbosity



< 5.7.2 : log_warnings
> 5.7.2 : log_error_verbosity

log_warnings: 

Deprecated 5.7.2 Command-Line Format — log-warnings[=#] 

System Variable Namelog-warnings
Variable ScopeGlobal
Dynamic VariableYes
Permitted Values (32-bit platforms, <= 5.7.1)
Typeinteger
Default1
Min Value0
Max Value4294967295
Permitted Values (32-bit platforms, >= 5.7.2)
Typeinteger
Default2
Min Value0
Max Value4294967295
Permitted Values (64-bit platforms, <= 5.7.1)
Typeinteger
Default1
Min Value0
Max Value18446744073709551615
Permitted Values (64-bit platforms, >= 5.7.2)
Typeinteger
Default2
Min Value0
Max Value18446744073709551615


Whether to produce additional warning messages to the error log. 

This variable is enabled by default (the default is 1 before MySQL 5.7.2, 2 as of 5.7.2). To disable it, set it to 0. The server logs messages about statements that are unsafe for statement-based logging if the value is greater than 0. Aborted connections and access-denied errors for new connection attempts are logged if the value is greater than 1. 


Enabling this option by setting it greater than 0 is recommended, if you use replication, to get more information about what is happening, such as messages about network failures and reconnections. If the value is greater than 1, aborted connections are written to the error log, and access-denied errors for new connection attempts are written.

If a slave server is started with log_warnings enabled, the slave prints messages to the error log to provide information about its status, such as the binary log and relay log coordinates where it starts its job, when it is switching to another relay log, when it reconnects after a disconnect, and so forth.

As of MySQL 5.7.2, information items previously governed by log_warnings are governed by log_error_verbosity, which is preferred over, and should be used instead of, the older log_warnings system variable. (The log_warningssystem variable and — log-warnings command-line option are deprecated and will be removed in a future MySQL release.)

Assigning a value to log_warnings assigns a value to log_error_verbosity and vice versa. The variables are related as follows:

Suppression of all log_warnings items, achieved with log_warnings=0, is achieved with log_error_verbosity=1 (errors only).

Items printed for log_warnings=1 or higher count as warnings and are printed for log_error_verbosity=2 or higher.

Items printed for log_warnings=2 count as notes and are printed for log_error_verbosity=3.

As of MySQL 5.7.2, the default log level is controlled by log_error_verbosity, which has a default of 3. 

In addition, the default for log_warnings changes from 1 to 2, which corresponds to log_error_verbosity=3.

To achieve a logging level similar to the previous default, set log_error_verbosity=2.

In MySQL 5.7.2 and higher, use of log_warnings is still permitted but maps onto use of log_error_verbosity as follows:


  • Setting log_warnings=0 is equivalent to log_error_verbosity=1 (errors only).

  • Setting log_warnings=1 is equivalent to log_error_verbosity=2 (errors, warnings).

  • Setting log_warnings=2 (or higher) is equivalent to log_error_verbosity=3 (errors, warnings, notes), 

the server sets log_warnings to 2 if a larger value is specified.