0

This question is an exact duplicate of:

i am getting the string in constructor. but how can i access that string in execute method. i am trying to access like this:

global class samplebatchcreateaccount implements Database.Batchable<sObject>, Database.Stateful {

    private String strParameter;

    public batchAccountInsert(String strParam) {
        strParameter = strParam;
    }

    global Database.QueryLocator start(Database.BatchableContext BC) {
        String query = 'select id,Name from Account';
        return Database.getQueryLocator(query);
    }

    global void execute(Database.BatchableContext BC, List<Account> scope) {
         System.debug('The string is'+strParameter); List<codeslist> lstcodeMapping = (List<codeslist>)JSON.deserialize(strParameter, List<codeslist>.class); system.debug('after deserializing'+lstcodeMapping);
    }   

    global void finish(Database.BatchableContext BC) {
    }
}

But I am unable to see the debug logs for the execute method. And here is my debuglogs:

41.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO 05:26:27.0 (285390)|USER_INFO|[EXTERNAL]|0056A000000Sl39|mallikarjuna.reddy@omuat.com|Pacific Standard Time|GMT-08:00 05:26:27.0 (326962)|EXECUTION_STARTED 05:26:27.0 (331392)|CODE_UNIT_STARTED|[EXTERNAL]|01p6A000006aLk7|codeexport 05:26:27.0 (108152368)|HEAP_ALLOCATE|[72]|Bytes:3 05:26:27.0 (108211072)|HEAP_ALLOCATE|[77]|Bytes:152 05:26:27.0 (108227794)|HEAP_ALLOCATE|[342]|Bytes:408 05:26:27.0 (108239195)|HEAP_ALLOCATE|[355]|Bytes:408 05:26:27.0 (108249275)|HEAP_ALLOCATE|[467]|Bytes:48 05:26:27.0 (108276314)|HEAP_ALLOCATE|[139]|Bytes:6 05:26:27.0 (108933539)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:1565418 05:26:27.0 (109075746)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:11 05:26:27.0 (109090285)|SYSTEM_METHOD_ENTRY|[15]|BatchableContextImpl.BatchableContextImpl() 05:26:27.0 (109096134)|STATEMENT_EXECUTE|[15] 05:26:27.0 (109104417)|SYSTEM_METHOD_EXIT|[15]|BatchableContextImpl 05:26:27.0 (109111550)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 05:26:27.0 (109115980)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 05:26:27.0 (109122279)|VARIABLE_SCOPE_BEGIN|[31]|this|Database.BatchableContextImpl|true|false 05:26:27.0 (109169772)|VARIABLE_ASSIGNMENT|[31]|this|{}|0x4d8b5242 05:26:27.0 (109176251)|VARIABLE_SCOPE_BEGIN|[31]|jobId|Id|false|false 05:26:27.0 (109251254)|VARIABLE_ASSIGNMENT|[31]|jobId|"7076A00000pFcWUQA0" 05:26:27.0 (109257177)|VARIABLE_SCOPE_BEGIN|[31]|childJobId|Id|false|false 05:26:27.0 (109265306)|VARIABLE_ASSIGNMENT|[31]|childJobId|null 05:26:27.0 (119993430)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:19 05:26:27.0 (120009426)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:75 05:26:27.0 (120013741)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:11 05:26:27.0 (120017076)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:44 05:26:27.0 (120028682)|METHOD_ENTRY|[1]|01p6A000006aLk7|codeexport.codeexport() 05:26:27.0 (120035995)|STATEMENT_EXECUTE|[1] 05:26:27.0 (120042090)|STATEMENT_EXECUTE|[1] 05:26:27.0 (120043412)|STATEMENT_EXECUTE|[3] 05:26:27.0 (120044547)|STATEMENT_EXECUTE|[18] 05:26:27.0 (120052170)|METHOD_EXIT|[1]|codeexport 05:26:27.0 (120060468)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8 05:26:27.0 (120065304)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 05:26:27.0 (120072239)|VARIABLE_SCOPE_BEGIN|[98]|this|codeexport|true|false 05:26:27.0 (120120742)|VARIABLE_ASSIGNMENT|[98]|this|{"ma":"[{\"slabel\":\"US:\",\"sc (1565390 more) ..."}|0x17285897 05:26:27.0 (120127287)|VARIABLE_SCOPE_BEGIN|[98]|BC|Database.BatchableContext|true|false 05:26:27.0 (120195694)|VARIABLE_ASSIGNMENT|[98]|BC|{"jobId":"7076A00000pFcWUQA0"}|0x4d8b5242 05:26:27.0 (120208876)|STATEMENT_EXECUTE|[98] 05:26:27.128 (128190671)|CUMULATIVE_LIMIT_USAGE 05:26:27.128 (128190671)|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

05:26:27.128 (128190671)|CUMULATIVE_LIMIT_USAGE_END

05:26:27.0 (128232648)|CODE_UNIT_FINISHED|codeexport 05:26:27.0 (128977142)|EXECUTION_FINISHED

And the second debug is:

41.0 APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WAVE,INFO;WORKFLOW,INFO 05:26:26.0 (334989)|USER_INFO|[EXTERNAL]|0056A000000Sl39|mallikarjuna.reddy@omuat.com|Pacific Standard Time|GMT-08:00 05:26:26.0 (370096)|EXECUTION_STARTED 05:26:26.0 (374815)|CODE_UNIT_STARTED|[EXTERNAL]|01p6A000006aLk7|codeexport 05:26:26.0 (107610321)|HEAP_ALLOCATE|[72]|Bytes:3 05:26:26.0 (107676240)|HEAP_ALLOCATE|[77]|Bytes:152 05:26:26.0 (107694540)|HEAP_ALLOCATE|[342]|Bytes:408 05:26:26.0 (107710500)|HEAP_ALLOCATE|[355]|Bytes:408 05:26:26.0 (107723397)|HEAP_ALLOCATE|[467]|Bytes:48 05:26:26.0 (107752433)|HEAP_ALLOCATE|[139]|Bytes:6 05:26:26.0 (108475704)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:1565418 05:26:26.0 (129215419)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:11 05:26:26.0 (129238156)|SYSTEM_METHOD_ENTRY|[15]|BatchableContextImpl.BatchableContextImpl() 05:26:26.0 (129243407)|STATEMENT_EXECUTE|[15] 05:26:26.0 (129254374)|SYSTEM_METHOD_EXIT|[15]|BatchableContextImpl 05:26:26.0 (129260964)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 05:26:26.0 (129264931)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:4 05:26:26.0 (129270355)|VARIABLE_SCOPE_BEGIN|[31]|this|Database.BatchableContextImpl|true|false 05:26:26.0 (129314843)|VARIABLE_ASSIGNMENT|[31]|this|{}|0x179637a5 05:26:26.0 (129320768)|VARIABLE_SCOPE_BEGIN|[31]|jobId|Id|false|false 05:26:26.0 (129395547)|VARIABLE_ASSIGNMENT|[31]|jobId|"7076A00000pFcWUQA0" 05:26:26.0 (129401938)|VARIABLE_SCOPE_BEGIN|[31]|childJobId|Id|false|false 05:26:26.0 (129409754)|VARIABLE_ASSIGNMENT|[31]|childJobId|null 05:26:26.0 (129732021)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:19 05:26:26.0 (129741504)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:75 05:26:26.0 (129745382)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:11 05:26:26.0 (129748483)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:44 05:26:26.0 (129755430)|METHOD_ENTRY|[1]|01p6A000006aLk7|codeexport.codeexport() 05:26:26.0 (129760541)|STATEMENT_EXECUTE|[1] 05:26:26.0 (129764180)|STATEMENT_EXECUTE|[1] 05:26:26.0 (129765412)|STATEMENT_EXECUTE|[3] 05:26:26.0 (129766749)|STATEMENT_EXECUTE|[18] 05:26:26.0 (129770457)|METHOD_EXIT|[1]|codeexport 05:26:26.0 (129775458)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:8 05:26:26.0 (129778453)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:12 05:26:26.0 (129783100)|VARIABLE_SCOPE_BEGIN|[37]|this|codeexport|true|false 05:26:26.0 (129808579)|VARIABLE_ASSIGNMENT|[37]|this|{"ma":"[{\"slabel\":\"US:\",\"sc (1565390 more) ..."}|0x3ced7b5e 05:26:26.0 (129815067)|VARIABLE_SCOPE_BEGIN|[37]|BC|Database.BatchableContext|true|false 05:26:26.0 (129860355)|VARIABLE_ASSIGNMENT|[37]|BC|{"jobId":"7076A00000pFcWUQA0"}|0x179637a5 05:26:26.0 (129870534)|STATEMENT_EXECUTE|[37] 05:26:26.0 (129872163)|STATEMENT_EXECUTE|[39] 05:26:26.0 (129875764)|HEAP_ALLOCATE|[39]|Bytes:48 05:26:26.0 (129881692)|VARIABLE_SCOPE_BEGIN|[39]|query|String|false|false 05:26:26.0 (129892014)|VARIABLE_ASSIGNMENT|[39]|query|"select id, name from (28 more) ..." 05:26:26.0 (129895792)|STATEMENT_EXECUTE|[40] 05:26:26.0 (129897834)|HEAP_ALLOCATE|[40]|Bytes:18 05:26:26.0 (130795615)|HEAP_ALLOCATE|[40]|Bytes:1565428 05:26:26.0 (130820062)|HEAP_ALLOCATE|[50]|Bytes:5 05:26:26.0 (130836924)|HEAP_ALLOCATE|[56]|Bytes:5 05:26:26.0 (130844181)|HEAP_ALLOCATE|[64]|Bytes:7 05:26:26.0 (130894104)|USER_DEBUG|[40]|DEBUG|initialState222 is[{"slabel":"US:","scode":"SF.BW1","qlabel":"BW1-BW1","lxkey":"rdm/lookupTypes/LKUP_IMS_BRICK_TYPE_BW1_US","ltname":"rdm/lookupTypes/LKUP_IMS_BRICK_TYPE","lpcode":"BW1","dtlabel":"US:","dtcode":"BW1","concode":"US","codestrans":[{"traexkey":"rdm/lookupTypes/LKUP_IMS_BRICK_TYPE_BW1_en-us_US","mdmltype":"a0Z6A000001xysbUAA","label":"BW1","isolcode":"en-us"},{"traexkey":"rdm/lookupTypes/LKUP_IMS_BRICK_TYPE_BW1_en_US","mdmltype":"a0Z6A000001xysbUAA","label":"BW1","isolcode":"en"}]} 05:26:26.0 (155354960)|STATEMENT_EXECUTE|[41] 05:26:26.0 (156676593)|SOQL_EXECUTE_BEGIN|[41]|Aggregations:0|select id, name from QIDC__MDM_LookupType_ims__c 05:26:26.0 (160336995)|SOQL_EXECUTE_END|[41]|Rows:0 05:26:26.260 (260164083)|CUMULATIVE_LIMIT_USAGE 05:26:26.260 (260164083)|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

05:26:26.260 (260164083)|CUMULATIVE_LIMIT_USAGE_END

05:26:26.0 (260227893)|CODE_UNIT_FINISHED|codeexport 05:26:26.0 (260981941)|EXECUTION_FINISHED

marked as duplicate by Adrian Larson Feb 15 '18 at 13:39

This question was marked as an exact duplicate of an existing question.

0

Each execute invocation gets its own log. If you are looking in the same log as that in which you kick off your batch, you're not going to find what you're looking for.

Not the answer you're looking for? Browse other questions tagged or ask your own question.