<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="error-log-configuration">
      </a>
      7.4.2.1 Error Log Configuration
     </h4>
    </div>
   </div>
  </div>
  <p>
   In MySQL 8.4, error logging uses the MySQL
        component architecture described at
   <a class="xref" href="components.html" title="7.5 MySQL Components">
    Section 7.5, “MySQL Components”
   </a>
   . The error log subsystem consists
        of components that perform log event filtering and writing, as
        well as a system variable that configures which components to
        load and enable to achieve the desired logging result.
  </p>
  <p>
   This section discusses how to load and enable components for
        error logging. For instructions specific to log filters, see
   <a class="xref" href="error-log-filtering.html" title="7.4.2.4 Types of Error Log Filtering">
    Section 7.4.2.4, “Types of Error Log Filtering”
   </a>
   . For instructions specific
        to the JSON and system log sinks, see
   <a class="xref" href="error-log-json.html" title="7.4.2.7 Error Logging in JSON Format">
    Section 7.4.2.7, “Error Logging in JSON Format”
   </a>
   , and
   <a class="xref" href="error-log-syslog.html" title="7.4.2.8 Error Logging to the System Log">
    Section 7.4.2.8, “Error Logging to the System Log”
   </a>
   . For additional details about
        all available log components, see
   <a class="xref" href="error-log-components.html" title="7.5.3 Error Log Components">
    Section 7.5.3, “Error Log Components”
   </a>
   .
  </p>
  <p>
   Component-based error logging offers these features:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      Log events that can be filtered by filter components to
            affect the information available for writing.
     </p>
    </li>
    <li class="listitem">
     <p>
      Log events that are output by sink (writer) components.
            Multiple sink components can be enabled, to write error log
            output to multiple destinations.
     </p>
    </li>
    <li class="listitem">
     <p>
      Built-in filter and sink components that implement the
            default error log format.
     </p>
    </li>
    <li class="listitem">
     <p>
      A loadable sink that enables logging in JSON format.
     </p>
    </li>
    <li class="listitem">
     <p>
      A loadable sink that enables logging to the system log.
     </p>
    </li>
    <li class="listitem">
     <p>
      System variables that control which log components to load
            and enable and how each component operates.
     </p>
    </li>
   </ul>
  </div>
  <p>
   Error log configuration is described under the following topics
        in this section:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-default-configuration" title="The Default Error Log Configuration">
       The Default Error Log Configuration
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-configuration-methods" title="Error Log Configuration Methods">
       Error Log Configuration Methods
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-implicit-configuration" title="Implicit Error Log Configuration">
       Implicit Error Log Configuration
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-explicit-configuration" title="Explicit Error Log Configuration">
       Explicit Error Log Configuration
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-configuration-change-method" title="Changing the Error Log Configuration Method">
       Changing the Error Log Configuration Method
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-configuration-troubleshooting" title="Troubleshooting Configuration Issues">
       Troubleshooting Configuration Issues
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-configuration-multiple-log-sinks" title="Configuring Multiple Log Sinks">
       Configuring Multiple Log Sinks
      </a>
     </p>
    </li>
    <li class="listitem">
     <p>
      <a class="xref" href="error-log-configuration.html#error-log-configuration-log-sink-ps-support" title="Log Sink Performance Schema Support">
       Log Sink Performance Schema Support
      </a>
     </p>
    </li>
   </ul>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-default-configuration">
       </a>
       The Default Error Log Configuration
      </h5>
     </div>
    </div>
   </div>
   <p>
    The
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    system
          variable controls which loadable log components to load, and
          which log components to enable for error logging. By default,
    <code class="literal">
     log_error_services
    </code>
    has the value shown
          here:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa37243220"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token variable">@@GLOBAL.log_error_services</span><span class="token punctuation">;</span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> @@GLOBAL.log_error_services            <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span>
<span class="token output"><span class="token punctuation">|</span> log_filter_internal; log_sink_internal <span class="token punctuation">|</span></span>
<span class="token output"><span class="token punctuation">+</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">-</span><span class="token punctuation">+</span></span></code></pre>
   </div>
   <p>
    That value indicates that log events first pass through the
    <code class="literal">
     log_filter_internal
    </code>
    filter component, then
          through the
    <code class="literal">
     log_sink_internal
    </code>
    sink
          component, both of which are built-in components. A filter
          modifies log events seen by components named later in the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value. A
          sink is a destination for log events. Typically, a sink
          processes log events into log messages that have a particular
          format and writes these messages to its associated output,
          such as a file or the system log.
   </p>
   <p>
    The combination of
    <code class="literal">
     log_filter_internal
    </code>
    and
    <code class="literal">
     log_sink_internal
    </code>
    implements the default
          error log filtering and output behavior. The action of these
          components is affected by other server options and system
          variables:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       The output destination is determined by the
       <a class="link" href="server-options.html#option_mysqld_log-error">
        <code class="option">
         --log-error
        </code>
       </a>
       option (and, on
              Windows,
       <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>
       ). These determine
              whether to write error messages to the console or a file
              and, if to a file, the error log file name. See
       <a class="xref" href="error-log-destination-configuration.html" title="7.4.2.2 Default Error Log Destination Configuration">
        Section 7.4.2.2, “Default Error Log Destination Configuration”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       The
       <a class="link" href="server-system-variables.html#sysvar_log_error_verbosity">
        <code class="literal">
         log_error_verbosity
        </code>
       </a>
       and
       <a class="link" href="server-system-variables.html#sysvar_log_error_suppression_list">
        <code class="literal">
         log_error_suppression_list
        </code>
       </a>
       system variables affect which types of log events
       <code class="literal">
        log_filter_internal
       </code>
       permits or
              suppresses. See
       <a class="xref" href="error-log-priority-based-filtering.html" title="7.4.2.5 Priority-Based Error Log Filtering (log_filter_internal)">
        Section 7.4.2.5, “Priority-Based Error Log Filtering (log_filter_internal)”
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
   <p>
    When configuring
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    , be aware
          of the following characteristics:
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       A list of log components may be delimited by semicolons or
              commas, optionally followed by spaces. A given setting
              cannot use both semicolon and comma separators. Component
              order is significant because the server executes
              components in the order listed.
      </p>
     </li>
     <li class="listitem">
      <p>
       The final component in the
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value
              cannot be a filter. This is an error because any changes
              it has on events would have no effect on output:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81201832"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 1231 (42000)<span class="token punctuation">:</span> Variable 'log_error_services' can't be set to the value
of 'log_filter_internal'</span></code></pre>
      </div>
      <p>
       To correct the problem, include a sink at the end of the
              value:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa30912458"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_internal'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       The order of components named in
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       is
              significant, particularly with respect to the relative
              order of filters and sinks. Consider this
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa20567247"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">log_filter_internal; log_sink_1; log_sink_2</code></pre>
      </div>
      <p>
       In this case, log events pass to the built-in filter, then
              to the first sink, then to the second sink. Both sinks
              receive the filtered log events.
      </p>
      <p>
       Compare that to this
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-none"><div class="docs-select-all right" id="sa77798578"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">log_sink_1; log_filter_internal; log_sink_2</code></pre>
      </div>
      <p>
       In this case, log events pass to the first sink, then to
              the built-in filter, then to the second sink. The first
              sink receives unfiltered events. The second sink receives
              filtered events. You might configure error logging this
              way if you want one log that contains messages for all log
              events, and another log that contains messages only for a
              subset of log events.
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-configuration-methods">
       </a>
       Error Log Configuration Methods
      </h5>
     </div>
    </div>
   </div>
   <p>
    Error log configuration involves loading and enabling error
          log components as necessary and performing component-specific
          configuration.
   </p>
   <p>
    There are two error log configuration methods,
    <span class="emphasis">
     <em>
      implicit
     </em>
    </span>
    and
    <span class="emphasis">
     <em>
      explicit
     </em>
    </span>
    . It is recommended that one
          configuration method is selected and used exclusively. Using
          both methods can result in warnings at startup. For more
          information, see
    <a class="xref" href="error-log-configuration.html#error-log-configuration-troubleshooting" title="Troubleshooting Configuration Issues">
     Troubleshooting Configuration Issues
    </a>
    .
   </p>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <span class="emphasis">
        <em>
         Implicit Error Log Configuration
        </em>
       </span>
      </p>
      <p>
       This configuration method loads and enables the log
              components defined by the
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       variable. Loadable components that are not already loaded
              are loaded implicitly at startup before the
       <code class="literal">
        InnoDB
       </code>
       storage engine is fully
              available. This configuration method has the following
              advantages:
      </p>
      <div class="itemizedlist">
       <ul class="itemizedlist" style="list-style-type: circle; ">
        <li class="listitem">
         <p>
          Log components are loaded early in the startup
                  sequence, before the
          <code class="literal">
           InnoDB
          </code>
          storage
                  engine, making logged information available sooner.
         </p>
        </li>
        <li class="listitem">
         <p>
          It avoids loss of buffered log information should a
                  failure occur during startup.
         </p>
        </li>
        <li class="listitem">
         <p>
          Installing error log components using
          <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
           <code class="literal">
            INSTALL COMPONENT
           </code>
          </a>
          is
                  not required, simplifying error log configuration.
         </p>
        </li>
       </ul>
      </div>
      <p>
       To use this method, see
       <a class="xref" href="error-log-configuration.html#error-log-implicit-configuration" title="Implicit Error Log Configuration">
        Implicit Error Log Configuration
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
   <div class="itemizedlist">
    <ul class="itemizedlist" style="list-style-type: disc; ">
     <li class="listitem">
      <p>
       <span class="emphasis">
        <em>
         Explicit Error Log Configuration
        </em>
       </span>
      </p>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        This configuration method is supported for backward
                compatibility. The implicit configuration method is
                recommended.
       </p>
      </div>
      <p>
       This configuration method requires loading error log
              components using
       <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
        <code class="literal">
         INSTALL
              COMPONENT
        </code>
       </a>
       and then configuring
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       to
              enable the log components.
       <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
        <code class="literal">
         INSTALL
              COMPONENT
        </code>
       </a>
       adds the component to the
       <code class="literal">
        mysql.component
       </code>
       table (an
       <code class="literal">
        InnoDB
       </code>
       table), and the components to
              load at startup are read from this table, which is only
              accessible after
       <code class="literal">
        InnoDB
       </code>
       is initialized.
      </p>
      <p>
       Logged information is buffered during the startup sequence
              while the
       <code class="literal">
        InnoDB
       </code>
       storage engine is
              initialized, which is sometimes prolonged by operations
              such as recovery and data dictionary upgrade that occur
              during the
       <code class="literal">
        InnoDB
       </code>
       startup sequence.
      </p>
      <p>
       To use this method, see
       <a class="xref" href="error-log-configuration.html#error-log-explicit-configuration" title="Explicit Error Log Configuration">
        Explicit Error Log Configuration
       </a>
       .
      </p>
     </li>
    </ul>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-implicit-configuration">
       </a>
       Implicit Error Log Configuration
      </h5>
     </div>
    </div>
   </div>
   <p>
    This procedure describes how to load and enable error logging
          components implicitly using
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    . For a
          discussion of error log configuration methods, see
    <a class="xref" href="error-log-configuration.html#error-log-configuration-methods" title="Error Log Configuration Methods">
     Error Log Configuration Methods
    </a>
    .
   </p>
   <p>
    To load and enable error logging components implicitly:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       List the error log components in the
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value.
      </p>
      <p>
       To load and enable the error log components at server
              startup, set
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       in an
              option file. The following example configures the use of
              the JSON log sink (
       <code class="literal">
        log_sink_json
       </code>
       ) in
              addition to the built-in log filter and sink
              (
       <code class="literal">
        log_filter_internal
       </code>
       ,
       <code class="literal">
        log_sink_internal
       </code>
       ).
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting language-ini"><div class="docs-select-all right" id="sa76924721"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-ini"><span class="token selector">[mysqld]</span>
<span class="token constant">log_error_services</span><span class="token attr-value"><span class="token punctuation">=</span>'log_filter_internal; log_sink_internal; log_sink_json'</span></code></pre>
      </div>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        To use the JSON log sink
                (
        <code class="literal">
         log_sink_syseventlog
        </code>
        ) instead of the
                default sink (
        <code class="literal">
         log_sink_internal
        </code>
        ), you
                would replace
        <code class="literal">
         log_sink_internal
        </code>
        with
        <code class="literal">
         log_sink_json
        </code>
        .
       </p>
      </div>
      <p>
       To load and enable the component immediately and for
              subsequent restarts, set
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       using
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              PERSIST
        </code>
       </a>
       :
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa6486525"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">PERSIST</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_internal; log_sink_json'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       If the error log component exposes any system variables
              that must be set for component initialization to succeed,
              assign those variables appropriate values. You can set
              these variables in an option file or using
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              PERSIST
        </code>
       </a>
       .
      </p>
      <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Important
       </div>
       <p>
        When implementing an implicit configuration, set
        <a class="link" href="server-system-variables.html#sysvar_log_error_services">
         <code class="literal">
          log_error_services
         </code>
        </a>
        first to load a component and expose its system
                variables, and then set component system variables
                afterward. This configuration order is required
                regardless of whether variable assignment is performed
                on the command-line, in an option file, or using
        <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
         <code class="literal">
          SET
                PERSIST
         </code>
        </a>
        .
       </p>
      </div>
     </li>
    </ol>
   </div>
   <p>
    To disable a log component, remove it from the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value.
          Also remove any associated component variables settings that
          you have defined.
   </p>
   <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
    <div class="admon-title">
     Note
    </div>
    <p>
     Loading a log component implicitly using
     <a class="link" href="server-system-variables.html#sysvar_log_error_services">
      <code class="literal">
       log_error_services
      </code>
     </a>
     has no
            effect on the
     <code class="literal">
      mysql.component
     </code>
     table. It
            does not add the component to the
     <code class="literal">
      mysql.component
     </code>
     table, nor does it remove
            a component previously installed using
     <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
      <code class="literal">
       INSTALL COMPONENT
      </code>
     </a>
     from the
     <code class="literal">
      mysql.component
     </code>
     table.
    </p>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-explicit-configuration">
       </a>
       Explicit Error Log Configuration
      </h5>
     </div>
    </div>
   </div>
   <p>
    This procedure describes how to load and enable error logging
          components explicitly by loading components using
    <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
     <code class="literal">
      INSTALL COMPONENT
     </code>
    </a>
    and then
          enabling using
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    . For a
          discussion of error log configuration methods, see
    <a class="xref" href="error-log-configuration.html#error-log-configuration-methods" title="Error Log Configuration Methods">
     Error Log Configuration Methods
    </a>
    .
   </p>
   <p>
    To load and enable error logging components explicitly:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Load the component using
       <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
        <code class="literal">
         INSTALL
              COMPONENT
        </code>
       </a>
       (unless it is built in or already
              loaded). For example, to load the JSON log sink, issue the
              following statement:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa57455818"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">INSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_log_sink_json'</span><span class="token punctuation">;</span></code></pre>
      </div>
      <p>
       Loading a component using
       <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
        <code class="literal">
         INSTALL
              COMPONENT
        </code>
       </a>
       registers it in the
       <code class="literal">
        mysql.component
       </code>
       system table so that
              the server loads it automatically for subsequent startups,
              after
       <code class="literal">
        InnoDB
       </code>
       is initialized.
      </p>
      <p>
       The URN to use when loading a log component with
       <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
        <code class="literal">
         INSTALL COMPONENT
        </code>
       </a>
       is the
              component name prefixed with
       <code class="literal">
        file://component_
       </code>
       . For example, for the
       <code class="literal">
        log_sink_json
       </code>
       component, the
              corresponding URN is
       <code class="literal">
        file://component_log_sink_json
       </code>
       . For
              error log component URNs, see
       <a class="xref" href="error-log-components.html" title="7.5.3 Error Log Components">
        Section 7.5.3, “Error Log Components”
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       If the error log component exposes any system variables
              that must be set for component initialization to succeed,
              assign those variables appropriate values. You can set
              these variables in an option file or using
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              PERSIST
        </code>
       </a>
       .
      </p>
     </li>
     <li class="listitem">
      <p>
       Enable the component by listing it in the
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       value.
      </p>
      <div class="important" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Important
       </div>
       <p>
        When loading log components explicitly using
        <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
         <code class="literal">
          INSTALL COMPONENT
         </code>
        </a>
        , do not
                persist or set
        <a class="link" href="server-system-variables.html#sysvar_log_error_services">
         <code class="literal">
          log_error_services
         </code>
        </a>
        in
                an option file, which loads log components implicitly at
                startup. Instead, enable log components at runtime using
                a
        <code class="literal">
         SET
                GLOBAL
        </code>
        statement.
       </p>
      </div>
      <p>
       The following example configures the use of the JSON log
              sink (
       <code class="literal">
        log_sink_json
       </code>
       ) in addition to the
              built-in log filter and sink
              (
       <code class="literal">
        log_filter_internal
       </code>
       ,
       <code class="literal">
        log_sink_internal
       </code>
       ).
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa51187408"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_internal; log_sink_json'</span><span class="token punctuation">;</span></code></pre>
      </div>
      <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
       <div class="admon-title">
        Note
       </div>
       <p>
        To use the JSON log sink
                (
        <code class="literal">
         log_sink_syseventlog
        </code>
        ) instead of the
                default sink (
        <code class="literal">
         log_sink_internal
        </code>
        ), you
                would replace
        <code class="literal">
         log_sink_internal
        </code>
        with
        <code class="literal">
         log_sink_json
        </code>
        .
       </p>
      </div>
     </li>
    </ol>
   </div>
   <p>
    To disable a log component, remove it from the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value.
          Then, if the component is loadable and you also want to unload
          it, use
    <a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
     <code class="literal">
      UNINSTALL COMPONENT
     </code>
    </a>
    .
          Also remove any associated component variables settings that
          you have defined.
   </p>
   <p>
    Attempts to use
    <a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
     <code class="literal">
      UNINSTALL
          COMPONENT
     </code>
    </a>
    to unload a loadable component that is
          still named in the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value
          produce an error.
   </p>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-configuration-change-method">
       </a>
       Changing the Error Log Configuration Method
      </h5>
     </div>
    </div>
   </div>
   <p>
    If you have previously loaded error log components explicitly
          using
    <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
     <code class="literal">
      INSTALL COMPONENT
     </code>
    </a>
    and
          want to switch to an implicit configuration, as described in
    <a class="xref" href="error-log-configuration.html#error-log-implicit-configuration" title="Implicit Error Log Configuration">
     Implicit Error Log Configuration
    </a>
    , the
          following steps are recommended:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Set
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       back to its default configuration.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa35065571"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal,log_sink_internal'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Use
       <a class="link" href="uninstall-component.html" title="15.7.4.5 UNINSTALL COMPONENT Statement">
        <code class="literal">
         UNINSTALL COMPONENT
        </code>
       </a>
       to
              uninstall any loadable logging components that you
              installed previously. For example, if you installed the
              JSON log sink previously, uninstall it as shown:
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa78985800"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">UNINSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_log_sink_json'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Remove any component variable settings for the uninstalled
              component. For example, if component variables were set in
              an option file, remove the settings from the option file.
              If component variables were set using
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              PERSIST
        </code>
       </a>
       , use
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         RESET
              PERSIST
        </code>
       </a>
       to clear the settings.
      </p>
     </li>
     <li class="listitem">
      <p>
       Follow the steps in
       <a class="xref" href="error-log-configuration.html#error-log-implicit-configuration" title="Implicit Error Log Configuration">
        Implicit Error Log Configuration
       </a>
       to
              reimplement your configuration.
      </p>
     </li>
    </ol>
   </div>
   <p>
    If you need to revert from an implicit configuration to an
          explicit configuration, perform the following steps:
   </p>
   <div class="orderedlist">
    <ol class="orderedlist" type="1">
     <li class="listitem">
      <p>
       Set
       <a class="link" href="server-system-variables.html#sysvar_log_error_services">
        <code class="literal">
         log_error_services
        </code>
       </a>
       back to its default configuration to unload implicitly
              loaded log components.
      </p>
      <div class="copytoclipboard-wrapper">
       <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa88837594"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal,log_sink_internal'</span><span class="token punctuation">;</span></code></pre>
      </div>
     </li>
     <li class="listitem">
      <p>
       Remove any component variable settings associated with the
              uninstalled components. For example, if component
              variables were set in an option file, remove the settings
              from the option file. If component variables were set
              using
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         SET
              PERSIST
        </code>
       </a>
       , use
       <a class="link" href="set-variable.html" title="15.7.6.1 SET Syntax for Variable Assignment">
        <code class="literal">
         RESET
              PERSIST
        </code>
       </a>
       to clear the settings.
      </p>
     </li>
     <li class="listitem">
      <p>
       Restart the server to uninstall the log components that
              were implicitly loaded.
      </p>
     </li>
     <li class="listitem">
      <p>
       Follow the steps in
       <a class="xref" href="error-log-configuration.html#error-log-explicit-configuration" title="Explicit Error Log Configuration">
        Explicit Error Log Configuration
       </a>
       to
              reimplement your configuration.
      </p>
     </li>
    </ol>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-configuration-troubleshooting">
       </a>
       Troubleshooting Configuration Issues
      </h5>
     </div>
    </div>
   </div>
   <p>
    Log components listed in the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value at
          startup are loaded implicitly early in the MySQL Server
          startup sequence. If the log component was loaded previously
          using
    <a class="link" href="install-component.html" title="15.7.4.3 INSTALL COMPONENT Statement">
     <code class="literal">
      INSTALL COMPONENT
     </code>
    </a>
    , the
          server attempts to load the component again later in the
          startup sequence, which produces the warning
    <span class="errortext">
     Cannot
          load component from specified URN:
          'file://component_
     <em class="replaceable">
      <code>
       component_name
      </code>
     </em>
     '
    </span>
    .
   </p>
   <p>
    You can check for this warning in the error log or by querying
          the Performance Schema
    <a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
     <code class="literal">
      error_log
     </code>
    </a>
    table using the following query:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa3322949"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span> error_code<span class="token punctuation">,</span> <span class="token keyword">data</span>
  <span class="token keyword">FROM</span> performance_schema<span class="token punctuation">.</span>error_log
 <span class="token keyword">WHERE</span> <span class="token keyword">data</span> <span class="token operator">LIKE</span> <span class="token string">"%'file://component_%"</span>
   <span class="token operator">AND</span> error_code<span class="token operator">=</span><span class="token string">"MY-013129"</span> <span class="token operator">AND</span> <span class="token keyword">data</span> <span class="token operator">LIKE</span> <span class="token string">"%MY-003529%"</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    To prevent this warning, follow the instructions in
    <a class="xref" href="error-log-configuration.html#error-log-configuration-change-method" title="Changing the Error Log Configuration Method">
     Changing the Error Log Configuration Method
    </a>
    to
          adjust your error log configuration. Either an implicit or
          explicit error log configuration should be used, but not both.
   </p>
   <p>
    A similar error occurs when attempting to explicitly load a
          component that was implicitly loaded at startup. For example,
          if
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    lists
          the JSON log sink component, that component is implicitly
          loaded at startup. Attempting to explicitly load the same
          component later returns this error:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa89032377"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">INSTALL</span> <span class="token keyword">COMPONENT</span> <span class="token string">'file://component_log_sink_json'</span><span class="token punctuation">;</span>
<span class="token output">ERROR 3529 (HY000)<span class="token punctuation">:</span> Cannot load component from specified URN<span class="token punctuation">:</span> 'file<span class="token punctuation">:</span>//component_log_sink_json'.</span></code></pre>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-configuration-multiple-log-sinks">
       </a>
       Configuring Multiple Log Sinks
      </h5>
     </div>
    </div>
   </div>
   <p>
    It is possible to configure multiple log sinks, which enables
          sending output to multiple destinations. To enable the JSON
          log sink in addition to (rather than instead of) the default
          sink, set the
    <a class="link" href="server-system-variables.html#sysvar_log_error_services">
     <code class="literal">
      log_error_services
     </code>
    </a>
    value like
          this:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting one-line language-sql"><div class="docs-select-all right" id="sa24189685"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_internal; log_sink_json'</span><span class="token punctuation">;</span></code></pre>
   </div>
   <p>
    To revert to using only the default sink and unload the system
          log sink, execute these statements:
   </p>
   <div class="copytoclipboard-wrapper">
    <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa39078936"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SET</span> <span class="token keyword">GLOBAL</span> log_error_services <span class="token operator">=</span> <span class="token string">'log_filter_internal; log_sink_internal;
UNINSTALL COMPONENT '</span><span class="token keyword">file</span>:<span class="token comment" spellcheck="true">//component_log_sink_json';</span></code></pre>
   </div>
  </div>
  <div class="simplesect">
   <div class="titlepage">
    <div>
     <div class="simple">
      <h5 class="title">
       <a name="error-log-configuration-log-sink-ps-support">
       </a>
       Log Sink Performance Schema Support
      </h5>
     </div>
    </div>
   </div>
   <p>
    If enabled log components include a sink that provides
          Performance Schema support, events written to the error log
          are also written to the Performance Schema
    <a class="link" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
     <code class="literal">
      error_log
     </code>
    </a>
    table. This enables
          examining error log contents using SQL queries. Currently, the
          traditional-format
    <code class="literal">
     log_sink_internal
    </code>
    and
          JSON-format
    <code class="literal">
     log_sink_json
    </code>
    sinks support
          this capability. See
    <a class="xref" href="performance-schema-error-log-table.html" title="29.12.22.2 The error_log Table">
     Section 29.12.22.2, “The error_log Table”
    </a>
    .
   </p>
  </div>
 </div>
 <br/>
</div>
