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 NameTypeDescription
categoryLogCategorySpecify the type of information returned in the debug log. Valid values are:
  • Db
  • Workflow
  • Validation
  • Callout
  • Apex_code
  • Apex_profiling
  • Visualforce
  • System
  • All
levelLogCategoryLevelSpecifies 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 LevelDescription
NONEDoes not include any log messages.
DEBUGONLYIncludes lower-level messages, and messages generated by calls to the System.debug method.
DBIncludes log messages generated by calls to the System.debug method, and every data manipulation language (DML) statement or inline SOQL or SOSL query.
PROFILEIncludes 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.
CALLOUTIncludes 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.
DETAILIncludes 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.