Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.1Mb
PDF (A4) - 35.2Mb
Man Pages (TGZ) - 256.4Kb
Man Pages (Zip) - 361.2Kb
Info (Gzip) - 3.4Mb
Info (Zip) - 3.4Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  / ...  / MySQL Server Administration  / MySQL Server Logs  / The Error Log  /  Error Logging to the System Log

5.4.2.3 Error Logging to the System Log

It is possible to havemysqld write the error log to the system log (the Event Log on Windows, andsyslog on Unix and Unix-like systems). To do so, use these system variables:

  • log_syslog: Enable this variable to send the error log to the system log. (On Windows,log_syslog is enabled by default.)

    Iflog_syslog is enabled, the following system variables can also be used for finer control.

  • log_syslog_facility: The default facility forsyslog messages isdaemon. Set this variable to specify a different facility.

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

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

Note

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

On Unix and Unix-like systems, control of output tosyslog is also available usingmysqld_safe, which can capture server error output and pass it tosyslog.

Note

Usingmysqld_safe forsyslog error logging is deprecated; you should use the server system variables instead.

mysqld_safe has three error-logging options,--syslog,--skip-syslog, and--log-error. The default with no logging options or with--skip-syslog is to use the default log file. To explicitly specify use of an error log file, specify--log-error=file_name tomysqld_safe, which then arranges formysqld to write messages to a log file. To usesyslog, specify the--syslog option. Forsyslog output, a tag can be specified with--syslog-tag=tag_val; this is appended to themysqld server identifier with a leading hyphen.