I have a batch 'mytestbatch' which runs everyday through scheduler. This batch will update more than 15lakhs records. During execution mytestbatch is throwing an error 'First error: Attempt to de-reference a null object'. I know this error is coming might be due to some bad data or some null values during an execution. I need to know from which line this error is coming. Under setup I have set the debug log for an user on whose name mytestbatch is running. But not able to capture the error due to exceeding debug log limits as more records are getting updated in this batch.
Can anyone tell how to capture this root cause of this error?
Best Answer
There are basically two options open to you:
It may be that you could manually invoke the batch through anonymous apex, in which case you can simply set up the SFDC_Console debug level, open the developer console, access the Execute Anonymous Apex dialog and explicitly call the execute batch. The console debug level is automatically applied to the user you opened the developer console as.