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
DML2020DML2020 

How do I find debug logs captured in the past?

I set up a debug log to run on a user a few days ago and do not see ANY files at the bottom of the page when you naviagte to SETUP -> DEBUG LOGS (although I can see the user trace flag set up).

In the dev console, I queried

SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog
 

and then 

SELECT Id, StartTime, LogUserId, LogLength, Location FROM ApexLog where LogUserId = '0051Y00000BHgss'
 

for the user ids who initiated the trace flag and the one for whom the debug log was run on, but to no avail (I see no results).

How do I get the logs?

AnkaiahAnkaiah (Salesforce Developers) 
Hi DML2022,

Debug logs have the following limits.
Each debug log must be 20 MB or smaller. Debug logs that are larger than 20 MB are reduced in size by removing older log lines, such as log lines for earlier System.debug statements. The log lines can be removed from any location, not just the start of the debug log.
System debug logs are retained for 24 hours. Monitoring debug logs are retained for seven days.
If you generate more than 1,000 MB of debug logs in a 15-minute window, your trace flags are disabled. We send an email to the users who last modified the trace flags, informing them that they can re-enable the trace flag in 15 minutes.
When your org accumulates more than 1,000 MB of debug logs, we prevent users in the org from adding or editing trace flags. To add or edit trace flags so that you can generate more logs after you reach the limit, delete some debug logs.

For more information, please refer the below article.

https://help.salesforce.com/s/articleView?id=sf.code_debug_log.htm&type=5

If this helps please mark it as answer for future reference.

Regards,
Ankaiah

 
mukesh guptamukesh gupta
Hi DML,

You can use LastModifiedDate in your SOQL filter criteria

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.

Thanks
Mukesh