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
degmodegmo 

Calling batch class from controller class & system.debug

Hello,
I have a controller class and inside this class I am calling a batch class to process records.  I have noticed that a system.debug statement inside the controller class isn't showing up in the logs but a system.debug statement inside the batch class does.  Any idea why that is?
 
public class AccController {

public static void ProcessAccount(string accId) {
system.debug('This isn't showing up in the debug log');

AccBatchClass accBatch = new AccBatchClass();
Database.executeBatch(accBatch, 200);

}
}

global class AccBatchClass implements Database.Batchable<sObject>{

global list<sObject> start(Database.batchableContext BC) {

}
global void execute((Database.BatchableContext BC, List<sObject> scope) {

system.debug('This is showing up in the logs');
}
}

 
Suraj Tripathi 47Suraj Tripathi 47
Hi,
Greetings!

If you use System.debug() inside Batch Class.
You can want to see your debug statement.
See bottom of your developer console, there is a tab called 'Logs'.
Select 'Logs', you will find many logs of Operation 'Batch Apex'.
Open the latest Log, you will find your debug statements there.

If you find your Solution then mark this as the best answer. 

Thank you!

Regards,
Suraj Tripathi