I have the below batch code
global class BatchClassAccountSched implements Database.Batchable<SObject>, Database.AllowsCallouts, Schedulable {
global Database.Querylocator start(Database.BatchableContext BC) {
String query = '';
if(Test.isRunningTest()){
query = 'SELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account WHERE Location__Latitude__s = null and Location__Longitude__s = null and ShippingStreet != null and ShippingCity != null and ShippingCountry != null and ShippingPostalCode != null and ShippingState != null and Owner.CEE_Sales_Group_Code__c != null limit 100';
system.debug('####query'+query);
}
else{
query = 'SELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account WHERE Location__Latitude__s = null and Location__Longitude__s = null LIMIT 100';
system.debug('@@@@ACCOUNT'+query);
}
system.debug('boh: '+Database.getQueryLocator(query));
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext bc, List<Account> scope) {
system.debug('in execute');
// create an address string
List<Account> newListAcc = new List<Account>();
for(Account accountNew : scope){
//stuff with a try-catch
}
system.debug('*****NUOVA LISTA ACCOUNT : ' + newListAcc);
update newListAcc;
system.debug('*****@@@'+newListAcc);
system.debug('*****@@@'+newListAcc.size());
}
/*global void execute(SchedulableContext sc) {
Database.executeBatch(this, 100);
}*/
global void execute(SchedulableContext sc) {
system.debug('prima');
Id batchJobId = Database.executeBatch(new BatchClassAccountSched());
system.debug('dopo');
}
global void finish(Database.BatchableContext BC){
}
}
but when i call it with
Database.executeBatch(new BatchClassAccountSched());
I do not see any debug from the execute method... why do you think this happen? I have tried to see the logs and they stop here. What is going on?
21:47:57.045 (45637604)|USER_DEBUG|[11]|DEBUG|@@@@ACCOUNTSELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account WHERE Location__Latitude__s = null and Location__Longitude__s = null LIMIT 100
21:47:57.045 (45644992)|SYSTEM_METHOD_EXIT|[11]|System.debug(ANY)
21:47:57.045 (45649162)|STATEMENT_EXECUTE|[13]
21:47:57.045 (45654232)|HEAP_ALLOCATE|[13]|Bytes:5
21:47:57.045 (45670639)|SYSTEM_METHOD_ENTRY|[13]|Database.getQueryLocator(String)
21:47:57.049 (49800773)|SOQL_EXECUTE_BEGIN|[13]|Aggregations:0|SELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account
21:47:57.088 (88418169)|SOQL_EXECUTE_END|[13]|Rows:100
21:47:57.088 (88492872)|HEAP_ALLOCATE|[13]|Bytes:20
21:47:57.088 (88517854)|SYSTEM_METHOD_EXIT|[13]|Database.getQueryLocator(String)
21:47:57.088 (88586282)|SYSTEM_METHOD_ENTRY|[13]|String.valueOf(Object)
21:47:57.088 (88608813)|HEAP_ALLOCATE|[13]|Bytes:204
21:47:57.088 (88623643)|SYSTEM_METHOD_EXIT|[13]|String.valueOf(Object)
21:47:57.088 (88632638)|HEAP_ALLOCATE|[13]|Bytes:209
21:47:57.088 (88644424)|SYSTEM_METHOD_ENTRY|[13]|System.debug(ANY)
21:47:57.088 (88652136)|USER_DEBUG|[13]|DEBUG|boh: Database.QueryLocator[Query=SELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account WHERE Location__Latitude__s = null and Location__Longitude__s = null LIMIT 100]
21:47:57.088 (88660061)|SYSTEM_METHOD_EXIT|[13]|System.debug(ANY)
21:47:57.088 (88665921)|STATEMENT_EXECUTE|[14]
21:47:57.088 (88674854)|SYSTEM_METHOD_ENTRY|[14]|Database.getQueryLocator(String)
21:47:57.089 (89004818)|SOQL_EXECUTE_BEGIN|[14]|Aggregations:0|SELECT ShippingCity,ShippingCountry,ShippingPostalCode,ShippingState,ShippingStreet FROM Account
21:47:57.157 (157240924)|SOQL_EXECUTE_END|[14]|Rows:100
21:47:57.157 (157305681)|HEAP_ALLOCATE|[14]|Bytes:20
21:47:57.157 (157329828)|SYSTEM_METHOD_EXIT|[14]|Database.getQueryLocator(String)
21:47:57.195 (195203238)|CUMULATIVE_LIMIT_USAGE
21:47:57.195 (195203238)|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 0 out of 200
Number of query rows: 0 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 0 out of 150
Number of DML rows: 0 out of 10000
Maximum CPU time: 0 out of 60000
Maximum heap size: 0 out of 12000000
Number of callouts: 0 out of 0
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 0
Number of queueable jobs added to the queue: 0 out of 1
Number of Mobile Apex push calls: 0 out of 10