You need to sign in to do that
Don't have an account?
cropzim
Apex class debug log filters
OK, I'm mystified by this.
1. Create simple Apex class
2. Override log filters in Force.com user interface to:
- Database = NONE
- Workflow = NONE
- Validation = NONE
- Callouts = NONE
- Apex Code = INFO
- Apex Profiling = NONE
- Visualforce = NONE
- System = NONE
3. Run Test on Class (also in Force.com UI: Setup | Develop |Apex Classes | <class> | Run Test)
RESULT:
- Although APEX Profiling log filter is NONE, I still get an APEX profile
- Although APEX Code = INFO, I still get Static variable listings - these are supposed to show only if Apex Code = FINE, FINER, FINEST
- Furthermore, the debug log header echoed by SFDC has no bearing on the override filters I specified. Instead, it shows:
25.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST
- Yet, the actual Apex Code log filter is honored as only my System.debug statement at LoggingLevel.INFO is displayed whereas the line at LoggingLevel.DEBUG is not (as expected)
You might say, so what? But when you have big complex APEX classes and multiple triggers firing, and a lot of constants, the debug log fills up with all sorts of noise that gets in the way
By the way, here's the code:
public without sharing class MyClass { public static final String MY_CONSTANT = 'My Constant'; // Constructor public MyClass() { System.debug(LoggingLevel.INFO,'should display on log filter INFO'); System.debug(LoggingLevel.DEBUG,'should display on log filter DEBUG'); } static testmethod void testMyClass () { MyClass myc = new MyClass(); } }
and here's the debug log:
25.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST 12:46:46.443 (6443874000)|EXECUTION_STARTED 12:46:46.443 (6443924000)|CODE_UNIT_STARTED|[EXTERNAL]|01pM00000009AuA|MyClass.testMyClass 12:46:46.445 (6445382000)|USER_DEBUG|[7]|INFO|should display on log filter INFO 12:46:40.396 (6445485000)|CUMULATIVE_LIMIT_USAGE 12:46:40.396|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 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 Number of script statements: 3 out of 200000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 10 Number of Email Invocations: 0 out of 10 Number of fields describes: 0 out of 100 Number of record type describes: 0 out of 100 Number of child relationships describes: 0 out of 100 Number of picklist describes: 0 out of 100 Number of future calls: 0 out of 10 12:46:40.396|TOTAL_EMAIL_RECIPIENTS_QUEUED|0 12:46:40.396|STATIC_VARIABLE_LIST| String:_static_MY_CONSTANT:0 double:MIN_NORMAL:0 double:POSITIVE_INFINITY:0 long:serialVersionUID:0 Boolean:TRUE:0 double:MIN_VALUE:0 int:SIZE:0 int[]:sizeTable:0 char[]:DigitOnes:0 char[]:DigitTens:0 String:_sfdcAdditionalCodeLocations:0 double:NaN:0 double:NEGATIVE_INFINITY:0 int:MIN_VALUE:0 int:SIZE:0 double:MAX_VALUE:0 String:_sfdcSuppressedCodeLocations:0 long:serialVersionUID:0 int:MAX_EXPONENT:0 int:MIN_EXPONENT:0 Boolean:FALSE:0 String:_sfdcSuppressedCodeLocations:0 int:MAX_VALUE:0 char[]:digits:0 long:serialVersionUID:0 12:46:40.396|CUMULATIVE_LIMIT_USAGE_END 12:46:46.445 (6445636000)|CODE_UNIT_FINISHED|MyClass.testMyClass 12:46:46.445 (6445647000)|EXECUTION_FINISHED 12:46:41.398|CUMULATIVE_PROFILING_BEGIN 12:46:41.398|CUMULATIVE_PROFILING|No profiling information for SOQL operations 12:46:41.398|CUMULATIVE_PROFILING|No profiling information for SOSL operations 12:46:41.398|CUMULATIVE_PROFILING|No profiling information for DML operations 12:46:41.398|CUMULATIVE_PROFILING|method invocations| External entry point: static testMethod void testMyClass(): executed 1 time in 1 ms Class.MyClass.<init>: line 7, column 1: global public static void debug(APEX_OBJECT, ANY): executed 1 time in 0 ms Class.MyClass.<init>: line 8, column 1: global public static void debug(APEX_OBJECT, ANY): executed 1 time in 0 ms Class.MyClass.testMyClass: line 11, column 1: public MyClass(): executed 1 time in 0 ms 12:46:41.398|CUMULATIVE_PROFILING_END
Thanks