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
log_filter_internal, and the
system log writer,
take effect immediately and for subsequent server startups. For
general configuration about configuring error logging, see
Section 22.214.171.124, “Error Log Component Configuration”.
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
INSTALL COMPONENT 'file://component_log_sink_syseventlog'; SET GLOBAL log_error_services = 'log_filter_internal; log_sink_syseventlog';
take effect at server startup, use the instructions at
Section 126.96.36.199, “Error Log Component Configuration”. Those
instructions apply to other error-logging system variables as
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
Noteare written to the Event Log, but not messages such as information statements from individual storage engines.
Event Log entries have a source of
On Unix and Unix-like systems, logging to the system log uses
syslog. The following system variables affect
log_syslog_facility: The default facility for
daemon. Set this variable to specify a different facility.
log_syslog_include_pid: Whether to include the server process ID in each line of
log_syslog_tag: This variable defines a tag to add to the server identifier (
syslogmessages. 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
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
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.