对于 mysql 5.7,默认的日志错误详细程度 是 3。我试图在 cnf 文件 中将其设置为 level of 2 但我不确定语法。
最佳答案
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
andini
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 将警告级别详细级别扩展到 3 并添加了 GLOBAL log_error_verbosity
.同样,它是 introduced在 5.7.2 中。它可以动态设置并作为变量检查或通过 cnf
设置。或 ini
配置文件设置。
从 MySQL 5.7.2 开始:
[mysqld]
log_error = /path/to/CurrentError.log
log_warnings = 2
log_error_verbosity = 3
如果需要,请将您的更改为 2,如上。
您可以分别动态设置和检查:
SET GLOBAL log_error_verbosity=2; -- set it
SELECT @@log_error_verbosity=2; -- sanity check, view it
然而这将被重置为 cnf
或 ini
服务器重启时的文件设置。
我会努力改进我们的文档页面。
如何设置配置文件(cnf
或 ini
,分别为 Linux 或 Windows)。
my.cnf 和 my.ini 文件位于 basedir
.如果它们不存在,您可以创建它们,否则它们将使用嵌入到服务器中的默认值。 basedir
中通常有一个 stub 文件,未激活,名为 my-default
, 作为模板。使用它来创建真正的 my.cnf 或 my.ini。发出一个
SELECT @@basedir;
找到my.ini
所在的位置(Windows) 或 my.cnf
(Linux) 应该驻留。请注意,您需要有足够的权限才能修改这些文件。例如,在 Windows 中,我需要以管理员身份运行记事本才能编写这样的文件。
以下是为确认对 my.ini
的更改而发出的一些命令(对于 Windows,my.cnf
对于 Linux)已设置 log_error_verbosity
到 2。请注意,这是 在 服务器重新启动后,这将使用那些 ini
或 cnf
变化:
我展示了 basedir
的使用因为那是你的ini
或 cnf
文件必须存在,具体取决于您的操作系统。
关于mysql - 日志记录详细程度 mysql 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37992813/