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
TehNrdTehNrd 

System.Exception: Too many script statements: 50001...new System Log problem

So I think the new system log is causing some of the test classes to fail. To test the "bulk" of my triggers most test classes process 200 records. Yet on opportunities we have tons of workflow, formulas, validations, etc. This is causing the Debug Log to explode on opportunity Triggers causing to many script statements.

I thought when salesforce.com updated instances it was going to run all the test classes to see if they pass?  If so what is going to happen when you update our production instance?

Also what can I do to fix this problem.

Thanks,
Jason

Message Edited by TehNrd on 11-06-2007 04:28 PM

TehNrdTehNrd
I understand the new system log was created with good intentions but it is really getting in the way of Apex development. Here are some debug logs when I run a test class in Summer07 and Winter07

Summer:
Code:
*** Beginning Test 1: applicationAutomationOnOpportunityTEST.static testMethod void UpdateTest()

20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 15, column 17: SelectLoop:LIST:SOBJECT:Automation__c
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 15, column 42: SOQL query with 57 rows finished in 7 ms
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 50, column 17: Insert: LIST:SOBJECT:Opportunity
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 50, column 17: DML Operation executed in 18843 ms
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 54, column 17: Update: LIST:SOBJECT:Opportunity
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 54, column 17: Changing testing limit context based on DML operation of size: 200
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 54, column 17: DML Operation executed in 8143 ms
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 58, column 18: SelectLoop:LIST:SOBJECT:Opportunity
20071107193615.649:Class.applicationAutomationOnOpportunityTEST.UpdateTest: line 58, column 40: SOQL query with 200 rows finished in 56 ms
20071107193615.649:Class.applicationAutomationOnOpportunityTEST: line 4, column 36: returning from end of method static testMethod void UpdateTest() in 27169 ms

Cumulative resource usage:
Number of SOQL queries: 3 out of 100
Number of query rows: 257 out of 500 ******* CLOSE TO LIMIT
Number of DML statements: 2 out of 100
Number of DML rows: 200 out of 500
Number of transaction control statements: 0 out of 0
Number of script statements: 3138 out of 200000
Maximum heap size: 39916 out of 500000
Number of callouts: 0 out of 10

Testing resources:
Number of SOQL queries: 4 out of 20
Number of query rows: 57 out of 200000
Number of DML statements: 0 out of 20
Number of DML rows: 200 out of 20000
Number of transaction control statements: 0 out of 0
Number of script statements: 14619 out of 50000
Maximum heap size: 1412 out of 500000
Number of callouts: 0 out of 10

Static variables and sizes:
flowControl:runApplicationAutomation:4

*** Ending Test applicationAutomationOnOpportunityTEST.static testMethod void UpdateTest()

Winter: Only  a little bit as I hit the 50,000 limit and it errors out.
EDIT: I was wrong, its not erroring out but it is reaching the maximum debug lenghth and then not showing me  Apex metrics.

Code:
Opportunity Record Type equals Won]
AND [Opportunity : Commission Split equals N]
AND [Opportunity : Opportunity Owner not equal to Sales User]
Value found: 012300000000103
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (APAC RFC Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Sales Order # (1 Max) contains RFC]
AND [Opportunity : Territory contains APAC]
AND [Opportunity : Probability (%) equals 100.0]
Value found: null
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (AMRS SVC-R Commission Split Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Commission Split equals Y]
AND [Opportunity : Opportunity Record Type equals completed service renewal booking]
AND [Opportunity : Probability (%) equals 100.0]
AND [Opportunity : Theater equals NA]
Value found: 1
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (AMRS Commission Split)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Opportunity Record Type equals Won]
AND [Opportunity : Commission Split equals Y]
Value found: 012300000000103
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: Deal Registration Expiration
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Opportunity Record Type not equal to Completed Booking EMEA, Completed Booking, Completed Service Renewal Booking, Lost, Abandoned]
Value found: 012300000000103
Criteria evaluates to true
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (EMEA Stock Sell Through Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Theater contains EMEA]
AND [Opportunity : Sales Order # (1 Max) contains stock]
AND [Opportunity : Probability (%) equals 100.0]
Value found: null
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (AMRS COMPLETED BOOKING)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Opportunity Record Type equals Completed Booking]
AND [Opportunity : Territory does not contain APAC]
Value found: 012300000000103
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (AMRS RFC Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Sales Order # (1 Max) contains RFC]
AND [Opportunity : Opportunity Record Type equals completed booking]
AND [Opportunity : Probability (%) equals 100.0]
Value found: null
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (AMRS Stock Sell Through Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Theater does not contain APAC, EMEA]
AND [Opportunity : Sales Order # (1 Max) contains stock]
AND [Opportunity : Probability (%) equals 100.0]
AND [Opportunity : Opportunity Record Type equals Completed Booking]
Value found: null
Value found: null
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (WW Shipped Orders)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Order Status contains Shipped]
AND [Opportunity : Order Type equals SO]
Value found: null
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (APAC Stock Sell Through Win)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Opportunity Record Type equals Won APAC]
AND [Opportunity : Type contains (sell-out)]
Value found: 012300000000103
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (EMEA Completed Booking)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Opportunity Record Type equals Completed SVC-R Booking EMEA, Completed Booking EMEA]
Value found: 012300000000103
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (APAC SVC-R Commission Split Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Commission Split equals Y]
AND [Opportunity : Opportunity Record Type equals completed service renewal booking]
AND [Opportunity : Probability (%) equals 100.0]
AND [Opportunity : Theater equals APAC]
AND [Opportunity : Opportunity Record Type not equal to Completed Service Renewal Booking]
Value found: 1
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: SF ALERT (APAC Commission Split Approval)
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
[Opportunity : Commission Split equals Y]
AND [Opportunity : Probability (%) equals 100.0]
AND [Opportunity : Theater contains APAC]
AND [Opportunity : Opportunity Record Type not equal to Completed Service Renewal Booking]
Value found: 1
Criteria evaluates to false
[Opportunity: Application Automation Testing74 006T0000002hXEz]
Rule Name: Dell Deals
Trigger type: ON_CREATE_OR_TRIGGERING_UPDATE
Evaluating Workflow Entry Criteria:
([Opportunity : Opportunity Name contains Dell] OR
[Opportunity : Reseller Company Name contains Dell]) AND

I apologize if I come across as a little rough, but how is this useful? I can't even see relevent Apex information and it breaks most of my test classes.

Thanks,
Jason


Message Edited by TehNrd on 11-09-2007 11:16 AM

Ron HessRon Hess
I'm not sure i understand how the system log output counts against your testMethod script limit, or any apex code limit for that matter.

It does sound like a serious roadblock if your existing tests fail due to the new deep system log. 
Are you sure these two orgs have all the same triggers and workflow rules in place?

We have some experts that can look into your issue, but you will have to file a case.


TehNrdTehNrd
The two orgs are nearly identical, we did a refresh before the sandbox was updatd. All workflow rules, validations, triggers, etc are the same in both.


What about this...

Do validation rules, workflow, etc, have script statements?
 
Perhaps now that these are being logged they are added against my script limit?

All I know is that the tests pass in Summer and fail in Winter. I'm just trying to figure out what changed (my code didn't, its identical). I saw that the log exploded in size so I just assumed the script statements where related.


Message Edited by TehNrd on 11-08-2007 01:52 PM

TehNrdTehNrd
Correlation does not equal causation. Big log != big script.

Apparently it was caused by a System.Debug statement pumping out too much data. I guess this adds up to a lot of script statements. My apologies for all the noise. I still like the old Summer log though as it shows a nice clean look at Apex metrics.

It's been one of those weeks.....




Message Edited by TehNrd on 11-08-2007 05:40 PM

teknicsandteknicsand
I'm running into the maximum debug log size problem!! It wasn't happening in Spring '09 release. I can't look at my debug log entirely to find out the issues I'm currently having with my test class!!!