- 7.4.2.1 错误日志配置7.4.2.1 Error Log Configuration
- 7.4.2.2 默认错误日志目标配置7.4.2.2 Default Error Log Destination Configuration
- 7.4.2.3 错误事件字段7.4.2.3 Error Event Fields
- 7.4.2.4 错误日志过滤类型7.4.2.4 Types of Error Log Filtering
- 7.4.2.5 基于优先级的错误日志过滤 (log_filter_internal)7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)
- 7.4.2.6 基于规则的错误日志过滤 (log_filter_dragnet)7.4.2.6 Rule-Based Error Log Filtering (log_filter_dragnet)
- 7.4.2.7 JSON 格式的错误日志记录7.4.2.7 Error Logging in JSON Format
- 7.4.2.8 错误日志记录到系统日志7.4.2.8 Error Logging to the System Log
- 7.4.2.9 错误日志输出格式7.4.2.9 Error Log Output Format
- 7.4.2.10 错误日志文件刷新和重命名7.4.2.10 Error Log File Flushing and Renaming
本节讨论如何配置 MySQL 服务器以将诊断消息记录到错误日志中。有关选择错误消息字符集和语言的信息,请参见 第 12.6 节,“错误消息字符集”,以及 第 12.12 节,“设置错误消息语言”。This section discusses how to configure the MySQL server for logging of diagnostic messages to the error log. For information about selecting the error message character set and language, see Section 12.6, “Error Message Character Set”, and Section 12.12, “Setting the Error Message Language”.
错误日志包含mysqld的启动和关闭时间记录。它还包含诊断消息,例如在服务器启动和关闭时以及服务器运行期间发生的错误、警告和注意事项。例如,如果mysqld发现某个表需要自动检查或修复,它会将消息写入错误日志。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. For example, if mysqld notices that a table needs to be automatically checked or repaired, it writes a message to the error log.
根据错误日志配置,错误消息也可能填充性能模式 error_log 表,以提供对日志的 SQL 接口并使其内容可被查询。参见 第 29.12.22.2 节,“error_log 表”。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. See
Section 29.12.22.2, “The error_log Table”.
在某些操作系统中,如果 mysqld 异常退出,错误日志中会包含堆栈跟踪。该跟踪可用于确定 mysqld 的退出位置。请参见 第 7.9 节,“调试 MySQL”。On some operating systems, the error log contains a stack trace if mysqld exits abnormally. The trace can be used to determine where mysqld exited. See Section 7.9, “Debugging MySQL”.
如果用于启动 mysqld,mysqld_safe 可能会将信息写入错误日志。例如,当 mysqld_safe 注意到 mysqld 异常退出时,它会重新启动 mysqld 并将 mysqld
restarted 信息写入错误日志。If used to start mysqld,
mysqld_safe may write messages to the error
log. For example, when mysqld_safe notices
abnormal mysqld exits, it restarts
mysqld and writes a mysqld
restarted message to the error log.
以下各节讨论了配置错误日志记录的各个方面。The following sections discuss aspects of configuring error logging.