3

I am running a batch job in my Sandbox from execute anonymous. When I create an object of the apex batch class and use database.executebatch(obj,50); I can run the apex class which does the batch process and open up a log in developer console. However I can see logs related to start() method of the batch class. I do not see logs related to what happened in execute() and finish() method. Where should I look for these log files if I am executing batch manually instead of using scheduler job.

12
  • You should be able to see in same place. Batch jibs are asynchronous so, it may take some time depending on system load.
    – Ashwani
    Nov 10, 2015 at 5:28
  • 1
    Yes , the log file opens up immediately in Developer Console. Is that log is all I have? or is there any where else I should look for additional log file. When I searched online to see why my debug statements in execute() method is not showing up in the log, I read that start,execute and finish all are in separate log files? Is that correct?
    – SfdcBat
    Nov 10, 2015 at 5:32
  • Yes, each execute call shown as separate log file.
    – Ashwani
    Nov 10, 2015 at 5:33
  • I have only one execute method though so should I able to see it in the log file which shows up when I run the apex class in execute anonymous?
    – SfdcBat
    Nov 10, 2015 at 5:34
  • Yes there should be 3 log files, 1. Execute Anonymous 2. Execute method 3. Finish method. Batch run in asynchronous mode so you may get these files after a delay.
    – Ashwani
    Nov 10, 2015 at 5:37

1 Answer 1

5

You should be able to see in same place. Batch jobs are asynchronous so, it may take some time depending on system load. It create separate file for execute and finish call.

Also make sure that you have setup debug logs for current logged use in Monitoring > Debug Logs.

With winter'16 you need to set up "User Trace Flags" with debug level for apex:DEBUG, system:DEBUG to see logs.

You must log in to answer this question.

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