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
Mitch McConnellMitch McConnell 

Where to find batch error logs?

We have two batch jobs that run just after midnight. When I run it manually via the Developer Console Anonymous window, they run fine. But last night, the "Apex Jobs" window showed that they failed. The Status states:
               Completed First error: Attempt to de-reference a null object
Now I know what that means, but I have no information to debug it. As I said, when I run it manually I can turn on the debug logs, but it does not fail.

It seems odd that there is no "master error log" where I can see more about what happened... or is there?scheduled-apex
David ZhuDavid Zhu
Hi,
If you use Scheduled Apex to run the batch, you can get the job submitter at Monitor|Jobs|Scheduled Jobs.
Then in Logs|Debug Logs, setup monitoring that specific user (the submitter).

You can find the log once the job runs. 

Hope this helps.

David
SeAlVaSeAlVa
I'm afraid not.

What I usually do is to catch the exception and create a document with the exception message and trace.

To make it easier to locate you can put them in a fixed folder.

The other option is to send an e-mail, but it can get a bit anoying if it fails very often.

Kind regards.