0

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

  • 2
    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 Jul 1 '16 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 Jul 1 '16 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 Jul 1 '16 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 Jul 1 '16 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 Jul 1 '16 at 14:05
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.