function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Apexdebug log details API

I can get the apex log infirmation from apexlog object


SELECT Application, LastModifiedDate, DurationMilliseconds, Location, Id, LogLength, LogUserId, Operation, Request, StartTime, Status, SystemModstamp FROM ApexLog


I dont see a column where I can get the details about the log , the information that you see when you click on View link in debug log screen against each debug log item.




The best way to get the body of an ApexLog programmatically is through the Tooling API. 

This is touched on in the Using Tooling REST API section: 

As well as the ApexLog page: 

The syntax is GET /sobjects/ApexLog/[id]/Body

You could do something highly not recommended like use this  URL:
But then you would have to worry about screen scraping considerations like setting the session ID.

Sorry it took so long for someone to respond...
Best of luck!

Nathan Pepper
Mihir Shah1Mihir Shah1
Hi NAthan,

I am trying to use get request. GET /sobjects/ApexLog/[id]/Body
But I am not getting desired response.  The error response is "You have attempted to reach a URL that no longer exists on".

Can you please help here?


It looks like that's the right format (as shown here: (" target="_blank)).

Make sure you replace "[id]" with the ID of the debug log you're trying to retrieve, for example:


Also, make sure you're using API version 28.0 or newer, and make sure the Debug Log has persisted and isn't removed.  ApexLogs made through the Developer Console are captured through User Trace Flags with LogType "DEVELOPER_LOG" and do not persist (I forget the time window... 60 minutes?), whereas ApexLogs that are captured through User Trace Flags with LogType "USER_DEBUG" will persist on the server until deleted.