Newer Version Available

This content describes an older version of this product. View Latest

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.

Element Name Type Description
category LogCategory Specify the type of information returned in the debug log. Valid values are:
  • Db
  • Workflow
  • Validation
  • Callout
  • Apex_code
  • Apex_profiling
  • Visualforce
  • System
  • All
level LogCategoryLevel Specifies the level of detail returned in the debug log.
Valid log levels are (listed from lowest to highest):
  • NONE
  • ERROR
  • WARN
  • INFO
  • DEBUG
  • FINE
  • FINER
  • FINEST

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

Log Level Description
NONE Does not include any log messages.
DEBUGONLY Includes lower-level messages, and messages generated by calls to the System.debug method.
DB Includes log messages generated by calls to the System.debug method, and every data manipulation language (DML) statement or inline SOQL or SOSL query.
PROFILE Includes log messages generated by calls to the System.debug 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.
CALLOUT 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.
DETAIL Includes all messages generated by the PROFILE level and the following.
  • Variable declaration statements
  • Start of loop executions
  • All loop controls, such as break and continue
  • Thrown exceptions *
  • Static and class initialization code *
  • Any changes in the with sharing context

The corresponding output header, DebuggingInfo, contains the resulting debug log. For more information, see DebuggingHeader in the SOAP API Developer Guide.