logging verbosity mysql 5.7
Asked Answered
M

1

11

The default log error verbosity is 3 for mysql 5.7. I'm trying to set this to a level of 2 in the cnf file but I'm not sure of the syntax.

Martica answered 23/6, 2016 at 13:17 Comment(3)
All the options in cnf are basically param = value, so you should add log_error_verbosity = 2.Francefrancene
this doesn't seem to work. Here's what I have....[mysqld_safe] datadir=/s01/mysqldata1 log-error= /n01/mysqladmin1/log/mysqld.log log_error_verbosity = 2 pid-file= /n01/mysqladmin1/mysqld.pid I restart mysqld and the value is still set to 3Martica
It seems having this value under mysqld_safe was the issue. Moved the param and value out and it now takes effect. thxMartica
M
12

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

Please see the MySQL Manual Page entitled [The Error Log][] especially for Flushing and Renaming the Error Log file, and [Error Log Verbosity] with versions related to log_warnings. 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

Please see the MySQL Manual Page entitled The Error Log especially for Flushing and Renaming the Error Log file, and Error Log Verbosity with versions related to log_warnings.

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 

Change yours to 2 if you want, above.

You can dynamically set, and check, respectively, with:

SET GLOBAL log_error_verbosity=2; -- set it
SELECT @@log_error_verbosity=2; -- sanity check, view it

yet this will be reset to cnf or ini file settings upon server restart.

enter image description here

I will try to improve our Docs page on that.

How to set the Configuration file (cnf or ini, Linux or Windows, respectively).

The my.cnf and my.ini files reside in the basedir. If they do not exist, you can create them, else they will use defaults baked into the server. Often there is a stubbed out file in basedir, not active, named my-default, as a template. Use that to create the real my.cnf or my.ini. Issue a

SELECT @@basedir;

to find the location where my.ini (Windows) or my.cnf (Linux) should reside. Note, you will need to have sufficient rights to modify these files. In Windows, for instance, I need to run Notepad as Administrator to write such a file.

The following are a few commands issued to confirm a change to my.ini (for Windows, my.cnf for Linux) having set log_error_verbosity to 2. Note this is after a server restart which would have used those ini or cnf changes:

enter image description here

I show the use of basedir because that is where your ini or cnf file must exist depending on your operating system.

Mainsail answered 6/8, 2016 at 13:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.