---
schema_version: "1"
id: 8fa427b90c308823eeb7d9d025a85f3f44c85e7d48beca7c4e72300a9835cd97
title: Debugging Apex API Calls
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_debugging_API_calls.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_debugging_API_calls.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: ff82570cefea547a5e8895db0fcef551b26ac70dc1dcbba770f548a53051018b
---
# Debugging Apex API Calls

All API calls that invoke Apex support a debug facility that allows access to detailed information about the execution of the code, including any calls to System.debug(). The categories field of a SOAP input header called DebuggingHeader allows you to set the logging granularity according to the levels outlined in this table.

<table class="featureTable sort_table" summary="">



        <thead class="thead sorted" align="left">
          <tr>
            <th class="featureTableHeader vertical-align-top " id="d67046e54">Element Name</th>

            <th class="featureTableHeader vertical-align-top " id="d67046e57">Type</th>

            <th class="featureTableHeader vertical-align-top " id="d67046e60">Description</th>

          </tr>

        </thead>

        <tbody class="tbody">
          <tr>
            <td class="entry" headers="d67046e54" data-title="Element Name"><span class="keyword parmname">category</span></td>

            <td class="entry" headers="d67046e57" data-title="Type">LogCategory</td>

            <td class="entry" headers="d67046e60" data-title="Description">Specify the type of information returned in
              the debug log. Valid values are:<ul class="ul bulletList">
                <li class="li"><samp class="codeph nolang">Db</samp></li>

                <li class="li"><samp class="codeph nolang">Workflow</samp></li>

                <li class="li"><samp class="codeph nolang">Validation</samp></li>

                <li class="li"><samp class="codeph nolang">Callout</samp></li>

                <li class="li"><samp class="codeph nolang">Apex_code</samp></li>

                <li class="li"><samp class="codeph nolang">Apex_profiling</samp></li>

                <li class="li"><samp class="codeph nolang">Visualforce</samp></li>

                <li class="li"><samp class="codeph nolang">System</samp></li>

                <li class="li"><samp class="codeph nolang">All</samp></li>

              </ul>
            </td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e54" data-title="Element Name"><span class="keyword parmname">level</span></td>

            <td class="entry" headers="d67046e57" data-title="Type">LogCategoryLevel</td>

            <td class="entry" headers="d67046e60" data-title="Description">Specifies the level of detail returned in the
              debug log.<div class="p">Valid log levels are (listed from
                lowest to highest):<a name="debug_log_levels_list"><!-- --></a>
                <ul class="ul bulletList" id="debug_log_levels_list">
                  <li class="li"><samp class="codeph apex_code">NONE</samp></li>

                  <li class="li"><samp class="codeph apex_code">ERROR</samp></li>

                  <li class="li"><samp class="codeph apex_code">WARN</samp></li>

                  <li class="li"><samp class="codeph apex_code">INFO</samp></li>

                  <li class="li"><samp class="codeph apex_code">DEBUG</samp></li>

                  <li class="li"><samp class="codeph apex_code">FINE</samp></li>

                  <li class="li"><samp class="codeph apex_code">FINER</samp></li>

                  <li class="li"><samp class="codeph apex_code">FINEST</samp></li>

                </ul>
              </div>
            </td>

          </tr>

        </tbody>

      </table>

In addition, the following log levels are still supported as part of the DebuggingHeader for backwards compatibility.

<table class="featureTable sort_table" summary="">


        <thead class="thead sorted" align="left">
          <tr>
            <th class="featureTableHeader vertical-align-top " id="d67046e190">Log Level</th>

            <th class="featureTableHeader vertical-align-top " id="d67046e193">Description</th>

          </tr>

        </thead>

        <tbody class="tbody">
          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">NONE</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Does not include any log messages.</td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">DEBUGONLY</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Includes lower-level messages, and messages
              generated by calls to the <samp class="codeph nolang">System.debug</samp>
              method.</td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">DB</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Includes log messages generated by calls to
              the <samp class="codeph apex_code">System.debug</samp> method, and every data
              manipulation language (DML) statement or inline
              SOQL or SOSL query.</td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">PROFILE</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Includes log messages generated by calls to
              the <samp class="codeph nolang">System.debug</samp> method, every DML statement
              or inline SOQL or SOSL query, and the entrance and
              exit of every user-defined method. In addition,
              the end of the debug log contains overall
              profiling information for the portions of the
              request that used the most resources. This
              profiling information is presented in terms of
              SOQL and SOSL statements, DML operations, and Apex
              method invocations. These three sections list the
              locations in the code that consumed the most time,
              in descending order of total cumulative time. Also
              listed is the number of times the categories
              executed.</td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">CALLOUT</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Includes the request-response XML that the
              server is sending and receiving from an external
              web service. Useful when debugging issues related
              to using Lightning Platform web service API calls
              or troubleshooting user access to external objects
              via Salesforce Connect.</td>

          </tr>

          <tr>
            <td class="entry" headers="d67046e190" data-title="Log Level"><samp class="codeph apex_code">DETAIL</samp></td>

            <td class="entry" headers="d67046e193" data-title="Description">Includes all messages generated by the
              <samp class="codeph apex_code">PROFILE</samp>
              level and the following.<ul class="ul bulletList">
                <li class="li">Variable declaration statements</li>

                <li class="li">Start of loop executions</li>

                <li class="li">All loop controls, such as break and
                  continue</li>

                <li class="li">Thrown exceptions * </li>

                <li class="li">Static and class initialization code * </li>

                <li class="li">Any changes in the <samp class="codeph apex_code">with sharing</samp>
                  context </li>

              </ul>
            </td>

          </tr>

        </tbody>

      </table>

The corresponding output header, DebuggingInfo, contains the resulting debug log. For more information, see [DebuggingHeader](https://developer.salesforce.com/docs/atlas.en-us.264.0.api.meta/api/sforce_api_header_debuggingheader.htm "HTML (New Window)") in the SOAP API Developer Guide.