You need to sign in to do that
Don't have an account?
Ken Koellner @ Engageware
How to get Debug Log Body with SOAP Tooling API?
We have an existing testing utility that uses the Tooling API. It is written using the SOAP version, not the REST version. I know I can query for the latest log for the user. I know there is a REST API to get the debug log body. But, I'd rather not have to recode using REST or mix REST/SOAP if I don't have to.
I tried the example below. The getDebuggingInfo() call returns null. If I got that back, I could call getDebugLog() on that to get the body. The comments at the end are simply notes of where I would start if I wanted to mix in REST.
Below is the output --
Anyone know a way to get the Debug Log body with SOAP? Or am I going to have to mix in a REST request? Or maybe the flags aren't set properly to get the log and that's why getDebuggingInfo is returning null?
I tried the example below. The getDebuggingInfo() call returns null. If I got that back, I could call getDebugLog() on that to get the body. The comments at the end are simply notes of where I would start if I wanted to mix in REST.
com.sforce.soap.tooling.LogInfo[] logList = new com.sforce.soap.tooling.LogInfo[1]; logList[0] = new com.sforce.soap.tooling.LogInfo(); logList[0].setCategory(com.sforce.soap.tooling.LogCategory.Apex_code); logList[0].setLevel(com.sforce.soap.tooling.LogCategoryLevel.Fine); ExecuteAnonymousResult apexResult = conn.executeAnonymous ("System.debug('Hello.');"); System.out.println(apexResult); com.sforce.soap.tooling.DebuggingInfo_element debuggingInfo = conn.getDebuggingInfo(); System.out.println(debuggingInfo); com.sforce.soap.tooling.GetUserInfoResult userResult = conn.getUserInfo(); String userId = userResult.getUserId(); System.out.println(userId); // SELECT Id FROM ApexLog WHERE LogUserId = userId ORDER BY LastModifiedDate DESC LIMIT 1 // /services/data/v49.0/sobjects/ApexLog/07L4p00000FU34uEAD/Body
Below is the output --
[ExecuteAnonymousResult column='-1' compileProblem='null' compiled='true' exceptionMessage='null' exceptionStackTrace='null' line='-1' success='true' ] null 005460000010bMfAA
Anyone know a way to get the Debug Log body with SOAP? Or am I going to have to mix in a REST request? Or maybe the flags aren't set properly to get the log and that's why getDebuggingInfo is returning null?
Greetings!
Have you checked the below thread which has sample code to get the debug logs using SOAP.
https://salesforce.stackexchange.com/questions/41837/get-debug-logs-with-specified-log-levels-for-execute-anonyous-via-apex-toolingap
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
Note that comment-- The issue I'm gettng is getDebuggingInfo() returned null. If you look at the raw soap, it's likely as the other programmer said in the above comment.
I found some much older posts with some info on it but they were out of date. I wonder is SF just simply removed that capability in the SOAP API many releases ago.
So, thanks for the response but it doesn't move any closer to an solution.