### 5.4.2 The Error Log

[5.4.2.1 Error Log Configuration](error-log-configuration.html)
[5.4.2.2 Default Error Log Destination Configuration](error-log-destination-configuration.html)
[5.4.2.3 Error Event Fields](error-log-event-fields.html)
[5.4.2.4 Types of Error Log Filtering](error-log-filtering.html)
[5.4.2.5 Priority-Based Error Log Filtering (log\_filter\_internal)](error-log-priority-based-filtering.html)
[5.4.2.6 Rule-Based Error Log Filtering (log\_filter\_dragnet)](error-log-rule-based-filtering.html)
[5.4.2.7 Error Logging in JSON Format](error-log-json.html)
[5.4.2.8 Error Logging to the System Log](error-log-syslog.html)
[5.4.2.9 Error Log Output Format](error-log-format.html)
[5.4.2.10 Error Log File Flushing and Renaming](error-log-rotation.html)

 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 10.6, “Error Message Character Set”](charset-errors.html), and [Section 10.12, “Setting the Error Message Language”](error-message-language.html).

 The error log contains a record of [**mysqld**](mysqld.html) 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**](mysqld.html) notices that a table needs to be automatically checked or repaired, it writes a message to the error log.

 Depending on error log configuration, error messages may also populate the Performance Schema [`error_log`](performance-schema-error-log-table.html) table, to provide an SQL interface to the log and enable its contents to be queried. See [Section 27.12.21.1, “The error\_log Table”](performance-schema-error-log-table.html).

 On some operating systems, the error log contains a stack trace if [**mysqld**](mysqld.html) exits abnormally. The trace can be used to determine where [**mysqld**](mysqld.html) exited. See [Section 5.9, “Debugging MySQL”](debugging-mysql.html).

 If used to start [**mysqld**](mysqld.html), [**mysqld\_safe**](mysqld-safe.html) may write messages to the error log. For example, when [**mysqld\_safe**](mysqld-safe.html) notices abnormal [**mysqld**](mysqld.html) exits, it restarts [**mysqld**](mysqld.html) and writes a `mysqld restarted` message to the error log.

 The following sections discuss aspects of configuring error logging.

