<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="error-log-destination-configuration">
      </a>
      7.4.2.2 Default Error Log Destination Configuration
     </h4>
    </div>
   </div>
  </div>
  <p>
   This section describes which server options configure the
        default error log destination, which can be the console or a
        named file. It also indicates which log sink components base
        their own output destination on the default destination.
  </p>
  <p>
   In this discussion,
   <span class="quote">
    “
    <span class="quote">
     console
    </span>
    ”
   </span>
   means
   <code class="literal">
    stderr
   </code>
   , the standard error output. This is
        your terminal or console window unless the standard error output
        has been redirected to a different destination.
  </p>
  <p>
   The server interprets options that determine the default error
        log destination somewhat differently for Windows and Unix
        systems. Be sure to configure the destination using the
        information appropriate to your platform. After the server
        interprets the default error log destination options, it sets
        the
   <a class="link" href="server-system-variables.html#sysvar_log_error">
    <code class="literal">
     log_error
    </code>
   </a>
   system variable
        to indicate the default destination, which affects where several
        log sink components write error messages. The following sections
        address these topics.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-destination-configuration.html#error-log-destination-configuration-windows" title="Default Error Log Destination on Windows">
       Default Error Log Destination on Windows
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-destination-configuration.html#error-log-destination-configuration-unix" title="Default Error Log Destination on Unix and Unix-Like Systems">
       Default Error Log Destination on Unix and Unix-Like Systems
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-destination-configuration.html#error-log-destination-sink-effects" title="How the Default Error Log Destination Affects Log Sinks">
       How the Default Error Log Destination Affects Log Sinks
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-destination-configuration-windows">
       </a>
       Default Error Log Destination on Windows
      </h5>
     </div>
    </div>
   </div>
   <p>
    On Windows,
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    uses the
    <a class="link" href="server-options.html#option_mysqld_log-error">
     <code class="option">
      --log-error
     </code>
    </a>
    ,
    <a class="link" href="server-system-variables.html#sysvar_pid_file">
     <code class="option">
      --pid-file
     </code>
    </a>
    , and
    <a class="link" href="server-options.html#option_mysqld_console">
     <code class="option">
      --console
     </code>
    </a>
    options to determine
          whether the default error log destination is the console or a
          file, and, if a file, the file name:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_console">
        <code class="option">
         --console
        </code>
       </a>
       is given, the
              default destination is the console.
              (
       <a class="link" href="server-options.html#option_mysqld_console">
        <code class="option">
         --console
        </code>
       </a>
       takes precedence
              over
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       if both
              are given, and the following items regarding
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       do not apply.)
      </p>
     </li>
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is not
              given, or is given without naming a file, the default
              destination is a file named
       <code class="filename">
        <em class="replaceable">
         <code>
          host_name
         </code>
        </em>
        .err
       </code>
       in the data directory, unless the
       <a class="link" href="server-system-variables.html#sysvar_pid_file">
        <code class="option">
         --pid-file
        </code>
       </a>
       option is
              specified. In that case, the file name is the PID file
              base name with a suffix of
       <code class="filename">
        .err
       </code>
       in
              the data directory.
      </p>
     </li>
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is given to
              name a file, the default destination is that file (with an
       <code class="filename">
        .err
       </code>
       suffix added if the name has no
              suffix). The file location is under the data directory
              unless an absolute path name is given to specify a
              different location.
      </p>
     </li>
    </ul>
   </div>
   <p>
    If the default error log destination is the console, the
          server sets the
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    system variable to
    <code class="literal">
     stderr
    </code>
    . Otherwise, the
          default destination is a file and the server sets
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    to the file name.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-destination-configuration-unix">
       </a>
       Default Error Log Destination on Unix and Unix-Like Systems
      </h5>
     </div>
    </div>
   </div>
   <p>
    On Unix and Unix-like systems,
    <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
     <span class="command">
      <strong>
       mysqld
      </strong>
     </span>
    </a>
    uses
          the
    <a class="link" href="server-options.html#option_mysqld_log-error">
     <code class="option">
      --log-error
     </code>
    </a>
    option to
          determine whether the default error log destination is the
          console or a file, and, if a file, the file name:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is not
              given, the default destination is the console.
      </p>
     </li>
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is given
              without naming a file, the default destination is a file
              named
       <code class="filename">
        <em class="replaceable">
         <code>
          host_name
         </code>
        </em>
        .err
       </code>
       in the data directory.
      </p>
     </li>
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is given to
              name a file, the default destination is that file (with an
       <code class="filename">
        .err
       </code>
       suffix added if the name has no
              suffix). The file location is under the data directory
              unless an absolute path name is given to specify a
              different location.
      </p>
     </li>
     <li class="listitem">
      <p>
       If
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       is given in
              an option file in a
       <code class="literal">
        [mysqld]
       </code>
       ,
       <code class="literal">
        [server]
       </code>
       , or
       <code class="literal">
        [mysqld_safe]
       </code>
       section, on systems that
              use
       <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
        <span class="command">
         <strong>
          mysqld_safe
         </strong>
        </span>
       </a>
       to start the server,
       <a class="link" href="mysqld-safe.html" title="6.3.2 mysqld_safe — MySQL Server Startup Script">
        <span class="command">
         <strong>
          mysqld_safe
         </strong>
        </span>
       </a>
       finds and uses the option,
              and passes it to
       <a class="link" href="mysqld.html" title="6.3.1 mysqld — The MySQL Server">
        <span class="command">
         <strong>
          mysqld
         </strong>
        </span>
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     It is common for Yum or APT package installations to
            configure an error log file location under
     <code class="filename">
      /var/log
     </code>
     with an option like
     <code class="literal">
      log-error=/var/log/mysqld.log
     </code>
     in a server
            configuration file. Removing the path name from the option
            causes the
     <code class="filename">
      <em class="replaceable">
       <code>
        host_name
       </code>
      </em>
      .err
     </code>
     file in the data directory to be used.
    </p>
   </div>
   <p>
    If the default error log destination is the console, the
          server sets the
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    system variable to
    <code class="literal">
     stderr
    </code>
    . Otherwise, the
          default destination is a file and the server sets
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    to the file name.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-destination-sink-effects">
       </a>
       How the Default Error Log Destination Affects Log Sinks
      </h5>
     </div>
    </div>
   </div>
   <p>
    After the server interprets the error log destination
          configuration options, it sets the
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    system variable to
          indicate the default error log destination. Log sink
          components may base their own output destination on the
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    value, or determine
          their destination independently of
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
   </p>
   <p>
    If
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    is
    <code class="literal">
     stderr
    </code>
    , the default error log destination
          is the console, and log sinks that base their output
          destination on the default destination also write to the
          console:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        log_sink_internal
       </code>
       ,
       <code class="literal">
        log_sink_json
       </code>
       ,
       <code class="literal">
        log_sink_test
       </code>
       : These sinks write to the
              console. This is true even for sinks such as
       <code class="literal">
        log_sink_json
       </code>
       that can be enabled
              multiple times; all instances write to the console.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        log_sink_syseventlog
       </code>
       : This sink writes
              to the system log, regardless of the
       <a class="link" href="server-system-variables.html#sysvar_log_error">
        <code class="literal">
         log_error
        </code>
       </a>
       value.
      </p>
     </li>
    </ul>
   </div>
   <p>
    If
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    is not
    <code class="literal">
     stderr
    </code>
    , the default error log destination
          is a file and
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    indicates the file name. Log sinks that base their output
          destination on the default destination base output file naming
          on that file name. (A sink might use exactly that name, or it
          might use some variant thereof.) Suppose that the
    <a class="link" href="server-system-variables.html#sysvar_log_error">
     <code class="literal">
      log_error
     </code>
    </a>
    value
    <em class="replaceable">
     <code>
      file_name
     </code>
    </em>
    . Then log sinks use the
          name like this:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <code class="literal">
        log_sink_internal
       </code>
       ,
       <code class="literal">
        log_sink_test
       </code>
       : These sinks write to
       <em class="replaceable">
        <code>
         file_name
        </code>
       </em>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        log_sink_json
       </code>
       : Successive instances of
              this sink named in the
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value
              write to files named
       <em class="replaceable">
        <code>
         file_name
        </code>
       </em>
       plus a numbered
       <code class="filename">
        .
        <em class="replaceable">
         <code>
          NN
         </code>
        </em>
        .json
       </code>
       suffix:
       <code class="filename">
        <em class="replaceable">
         <code>
          file_name
         </code>
        </em>
        .00.json
       </code>
       ,
       <code class="filename">
        <em class="replaceable">
         <code>
          file_name
         </code>
        </em>
        .01.json
       </code>
       ,
              and so forth.
      </p>
     </li>
     <li class="listitem">
      <p>
       <code class="literal">
        log_sink_syseventlog
       </code>
       : This sink writes
              to the system log, regardless of the
       <a class="link" href="server-system-variables.html#sysvar_log_error">
        <code class="literal">
         log_error
        </code>
       </a>
       value.
      </p>
     </li>
    </ul>
   </div>
  </div>
 </div>
 <br/>
</div>
