I am trying to set a scheduled Apex job to run daily at 1AM. Records are not being inserted as I believe they should be. I imagine there is are errors occurring during execution of the class. I have a bunch of System.Debug statements to write errors that occur. I unfortunately do not see any debug logs listed on Setup -> Monitoring -> Debug Logs. All I see is User Trace Flags and an empty list under Debug Logs.

Debug Logs are empty enter image description here

  • 3
    The Submitted By user for the job should be same as Name field in the debug log. Check if it is causing the issue?
    – Saroj Bera
    Commented Jul 1, 2016 at 13:25
  • @SarojBera Where do you see Name field in the debug log? I only see user. My list of debug logs is empty as well.
    – gberg927
    Commented Jul 1, 2016 at 13:36
  • 1
    When you create a new debug log, Traced Entity Type should be User and the Traced Entity Name should be same user as that of Submitted By for the job.
    – Saroj Bera
    Commented Jul 1, 2016 at 13:47
  • @SarojBera I guess I don't know how to create a Debug Log then. If you look at the screen shot I posted I only have a Delete All option. Should there be a "New" option?
    – gberg927
    Commented Jul 1, 2016 at 13:51
  • 1
    You have to first create a trace flags to see debug logs. Please follow this link to create one help.salesforce.com/…
    – Saroj Bera
    Commented Jul 1, 2016 at 14:05

2 Answers 2


Debug logs are not running all the time, there is a limit of 20 logs captured per trace set up.

  1. Schedule the trace to start right before your batch scheduled time
    • If the user is active in the system however this could consume the 20 logs before the batch is run

If your batch has a lot of 'chunks' you could consume the 20 logs before the error has occurred.

You best bet is to manually run the batch and monitor it via the dev console.


This solved it for me,

After scheduling your apex class either by using dev console and execute anonymous, or by using the UI,

  • Go to setup -> scheduled jobs and check the Submitted by the field for the specific scheduled job, this user name is important
  • Go to setup -> debug logs and click on new
  • trace entity type must be user
  • trace entity name must be the same user as you saw in the submitted by field
  • Get your start and end time correct (make sure they overlap the time when your scheduled class will run)
  • Select your debug level by referring to the official documentation in the Trailblazer Community or complete this Trailhead module

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .