The standard Debug Logs page in Salesforce Setup does not allow setting up debug logs for automated or system-level users, such as S2S (Salesforce-to-Salesforce) connection users or integration users. To capture debug logs for these users, you must use the Salesforce Tooling API to create a TraceFlag record manually. A TraceFlag defines the debug log scope — including who to debug, when to start and stop, and what logging level to apply.
Use Workbench's REST Explorer to send a POST request to the Tooling API TraceFlag endpoint. Workbench is a free Salesforce developer tool available at workbench.developerforce.com.
/services/data/v35.0/tooling/sobjects/TraceFlag/USER_DEBUG to capture user-level debug information./services/data/v35.0/tooling/sobjects/TraceFlag/
{
"TracedEntityId" : "005i0000002Xx2qAAC",
"ExpirationDate" : "2016-01-07T15:04:31.000+0000",
"DebugLevelId" : "7dli0000000GmaEAAS",
"LogType" : "USER_DEBUG",
"StartDate" : "2016-01-07T14:34:31.000+0000"
}
To obtain the DebugLevelId, run the query "SELECT Id, DeveloperName FROM DebugLevel" in the Developer Console. Make sure to check the Tooling API checkbox in the Query Editor to enable Tooling API queries. The returned Id values correspond to available debug levels you can use in your TraceFlag request.
000386565

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.