Documentation Home
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 38.0Mb
PDF (A4) - 38.0Mb
PDF (RPM) - 32.9Mb
HTML Download (TGZ) - 8.0Mb
HTML Download (Zip) - 8.1Mb
HTML Download (RPM) - 6.9Mb
Man Pages (TGZ) - 132.9Kb
Man Pages (Zip) - 189.5Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 8.0 Reference Manual  /  ...  /  Error Logging to the System Log

5.4.2.3 Error Logging to the System Log

It is possible to have mysqld write the error log to the system log. This is the Event Log on Windows, and syslog on Unix and Unix-like systems.

This section describes how to configure error logging using the built-in filter, log_filter_internal, and the system log writer, log_sink_syseventlog, to take effect immediately and for subsequent server startups. For general configuration about configuring error logging, see Section 5.4.2.1, “Error Log Component Configuration”.

Note

In MySQL 8.0, you must configure system log error logging explicitly. This differs from MySQL 5.7 and earlier, for which logging to the system log is enabled by default on Windows, and on all platforms requires no component loading.

To enable the system log writer, first load the writer component, then modify the log_error_services value:

INSTALL COMPONENT 'file://component_log_sink_syseventlog';
SET GLOBAL log_error_services = 'log_filter_internal; log_sink_syseventlog';

To set log_error_services to take effect at server startup, use the instructions at Section 5.4.2.1, “Error Log Component Configuration”. Those instructions apply to other error-logging system variables as well.

Note

Logging to the system log may require additional system configuration. Consult the system log documentation for your platform.

On Windows, error messages written to the Event Log within the Application log have these characteristics:

  • Entries marked as Error, Warning, and Note are written to the Event Log, but not messages such as information statements from individual storage engines.

  • Event Log entries have a source of MySQL.

On Unix and Unix-like systems, logging to the system log uses syslog. The following system variables affect syslog messages:

  • log_syslog_facility: The default facility for syslog messages is daemon. Set this variable to specify a different facility.

  • log_syslog_include_pid: Whether to include the server process ID in each line of syslog output.

  • log_syslog_tag: This variable defines a tag to add to the server identifier (mysqld) in syslog messages. If defined, the tag is appended to the identifier with a leading hyphen.

MySQL uses the custom label System for important system messages about non-error situations, such as startup, shutdown, and some significant changes to settings. In logs that do not support custom labels, including the Event Log on Windows, and syslog on Unix and Unix-like systems, system messages are assigned the label used for the information level of severity. However, these messages are printed to the log even if the MySQL log_error_verbosity setting would normally exclude messages at the information level.

If your system has additional configuration to discard messages labeled as information level, or to redirect them to a different destination from messages labeled as errors, system messages do not override this behavior. Where the log writer involved does not use the System label, system messages are discarded or redirected along with other messages labeled as information level, unless you set up further custom configuration to handle them.


User Comments
Sign Up Login You must be logged in to post a comment.