mysql - 日志记录详细程度 mysql 5.7

标签 mysql logging verbosity

对于 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 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 将警告级别详细级别扩展到 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

然而这将被重置为 cnfini服务器重启时的文件设置。

enter image description here

我会努力改进我们的文档页面。

如何设置配置文件(cnfini,分别为 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。请注意,这是 服务器重新启动后,这将使用那些 inicnf变化:

enter image description here

我展示了 basedir 的使用因为那是你的inicnf文件必须存在,具体取决于您的操作系统。

关于mysql - 日志记录详细程度 mysql 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37992813/

相关文章:

mysql建表并为索引设置createtime(int),但是select没有使用,为什么呢?

ASP.NET - Serilog - 多个接收器,每个接收器用于不同的用途

bash - 脚本中详细模式的优雅方式?

使用 codeigniter 的 Mysql 数据透视表

MySQL:ORDER BY 显着减慢了查询速度

Python MySQLdb转义字符: query works in MySQL but not in python MySQLdb

c++ - 有没有办法用 Boost.Log 实现多个独立的日志系统?

logging - Celery Worker – 删除警告消息 `[WARNING/MainProcess] celery@localhost ready`

haskell - 函数式编程是否需要新的命名约定?

docker - 如何启用Docker守护程序的 “debug”日志记录? (Ubuntu 16.04)