5.4.2 The Error Log错误日志

5.4.2.1 Error Log Configuration错误日志配置
5.4.2.2 Default Error Log Destination Configuration默认错误日志目标配置
5.4.2.3 Error Event Fields错误事件字段
5.4.2.4 Types of Error Log Filtering错误日志筛选的类型
5.4.2.5 Priority-Based Error Log Filtering 基于优先级的错误日志筛选(log_filter_internal)
5.4.2.6 Rule-Based Error Log Filtering 基于规则的错误日志筛选(log_filter_dragnet)
5.4.2.7 Error Logging in JSON FormatJSON格式的错误日志记录
5.4.2.8 Error Logging to the System Log错误记录到系统日志
5.4.2.9 Error Log Output Format错误日志输出格式
5.4.2.10 Error Log File Flushing and Renaming错误日志文件刷新和重命名

This section discusses how to configure the MySQL server for logging of diagnostic messages to the error log. 本节讨论如何配置MySQL服务器,以便将诊断消息记录到错误日志中。For information about selecting the error message character set and language, see Section 10.6, “Error Message Character Set”, and Section 10.12, “Setting the Error Message Language”.有关选择错误消息字符集和语言的信息,请参阅第10.6节,“错误消息字符集合”第10.12节,“设置错误消息语言”

The error log contains a record of mysqld startup and shutdown times. It also contains diagnostic messages such as errors, warnings, and notes that occur during server startup and shutdown, and while the server is running. 错误日志包含mysqld启动和关闭时间的记录。它还包含诊断消息,如服务器启动和关闭期间以及服务器运行期间发生的错误、警告和说明。For example, if mysqld notices that a table needs to be automatically checked or repaired, it writes a message to the error log.例如,如果mysqld注意到需要自动检查或修复表,它会在错误日志中写入一条消息。

Depending on error log configuration, error messages may also populate the Performance Schema error_log table, to provide an SQL interface to the log and enable its contents to be queried. 根据错误日志的配置,错误消息也可能填充性能模式error_log表,以向日志提供SQL接口并允许查询其内容。See Section 27.12.21.1, “The error_log Table”.请参阅第27.12.21.1节,“错误日志表”

On some operating systems, the error log contains a stack trace if mysqld exits abnormally. 在某些操作系统上,如果mysqld异常退出,错误日志会包含堆栈跟踪。The trace can be used to determine where mysqld exited. See Section 5.9, “Debugging MySQL”.该跟踪可用于确定mysqld退出的位置。请参阅第5.9节,“调试MySQL”

If used to start mysqld, mysqld_safe may write messages to the error log. 如果用于启动mysqldmysqld_safe可能会将消息写入错误日志。For example, when mysqld_safe notices abnormal mysqld exits, it restarts mysqld and writes a mysqld restarted message to the error log.例如,当mysqld_safe注意到异常的mysqld退出时,它会重新启动mysqld,并将mysqld重新启动的消息写入错误日志。

The following sections discuss aspects of configuring error logging.以下部分讨论配置错误日志的各个方面。

5.4.2.1 Error Log Configuration
5.4.2.2 Default Error Log Destination Configuration
5.4.2.3 Error Event Fields
5.4.2.4 Types of Error Log Filtering
5.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)
5.4.2.6 Rule-Based Error Log Filtering (log_filter_dragnet)
5.4.2.7 Error Logging in JSON Format
5.4.2.8 Error Logging to the System Log
5.4.2.9 Error Log Output Format
5.4.2.10 Error Log File Flushing and Renaming