• Vladimir G
  • NEWBIE
  • 10 Points
  • Member since 2015
  • The Welkin Suite


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies
Hi,

When I'm trying to override trace flags for a class - everything looks fine except of constructors.

For example I have such DummyClass:
public virtual class DummyClass {  
    public DummyClass(String test) {
        System.debug('Called DummyClass constructor with '+test+' parameter');
        Void_Method_Without_Params();
    }

    public void Void_Method_Without_Params() {
        System.debug('DummyClass.Void_Method_Without_Params');
    }

    /* And lots of other static methods */
}
And such unit test:
@istest
public class MethodCalls {
    
    public static testmethod void Test_Inner_Static_Methods_Calls() {
        DummyClass obj=new DummyClass('Testing constructor');

        /* Lots of DummyClass static and instance methods calls */
    }

Global Trace for the user is set to DEBUG everywhere and for DummyClass it's set to FINEST everywhere.
Here's what I get in the debug log:
34.0 APEX_CODE,DEBUG;APEX_PROFILING,DEBUG;CALLOUT,DEBUG;DB,DEBUG;SYSTEM,DEBUG;VALIDATION,DEBUG;VISUALFORCE,DEBUG;WORKFLOW,DEBUG
06:23:02.0 (64084)|EXECUTION_STARTED
06:23:02.0 (136558)|CODE_UNIT_STARTED|[EXTERNAL]|01p36000001UZUF|MethodCalls.Test_Inner_Static_Methods_Calls
06:23:02.0 (8498670)|USER_DEBUG|[55]|DEBUG|Called DummyClass constructor with Testing constructor parameter
06:23:02.0 (8595762)|PUSH_TRACE_FLAGS|[56]|01p36000001UXWj|DummyClass|APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINEST;VALIDATION,FINEST;VISUALFORCE,FINEST;WORKFLOW,FINEST
06:23:02.0 (8610577)|METHOD_ENTRY|[56]|01p36000001UXWj|DummyClass.Void_Method_Without_Params()
06:23:02.0 (8639280)|VARIABLE_SCOPE_BEGIN|[63]|this|DummyClass|true|false
06:23:02.0 (8695301)|VARIABLE_ASSIGNMENT|[63]|this|{"AutoField":1}|0x29c5dd7d
06:23:02.0 (8708182)|STATEMENT_EXECUTE|[63]
06:23:02.0 (8710219)|STATEMENT_EXECUTE|[64]
06:23:02.0 (8712590)|LIMIT_USAGE|[64]|SCRIPT_STATEMENTS|10|200000
06:23:02.0 (8719003)|HEAP_ALLOCATE|[64]|Bytes:37
06:23:02.0 (8737361)|SYSTEM_METHOD_ENTRY|[64]|System.debug(ANY)
06:23:02.0 (8754229)|USER_DEBUG|[64]|DEBUG|DummyClass.Void_Method_Without_Params
06:23:02.0 (8760422)|SYSTEM_METHOD_EXIT|[64]|System.debug(ANY)
06:23:02.0 (8766224)|METHOD_EXIT|[56]|01p36000001UXWj|DummyClass.Void_Method_Without_Params()
06:23:02.0 (8785480)|POP_TRACE_FLAGS|[56]|01p36000001UXWj|DummyClass|APEX_CODE,DEBUG;APEX_PROFILING,DEBUG;CALLOUT,DEBUG;DB,DEBUG;SYSTEM,DEBUG;VALIDATION,DEBUG;VISUALFORCE,DEBUG;WORKFLOW,DEBUG
As you may notice in the line below:
06:23:02.0 (8498670)|USER_DEBUG|[55]|DEBUG|Called DummyClass constructor with Testing constructor parameter
There's a direct User_Debug entry - without any PUSH_TRACE_FLAGS, Method/Constructor entries, statement executes and so on. So this means that all the code in the DummyClass constructor was executed with the DEBUG level. However when constructor calls another method - everything gets fine and FINEST levels are applied for that method, but nor for the constructor...
The same applies for a static constructors.

I've tried to search for this in the Known Bugs, but no luck.
Any ideas how to workaround this (without changing the code itself) or how to bring SF's attention to fix this issue?

Thanks,
Vladimir
 
I have seen eclipse IDE where Apex class and Controller as well visualforce page can be created just like Salesforce console developer.
Is there any way we can have same in VSS IDE.

Regards
Aniket
Hi,

When I'm trying to override trace flags for a class - everything looks fine except of constructors.

For example I have such DummyClass:
public virtual class DummyClass {  
    public DummyClass(String test) {
        System.debug('Called DummyClass constructor with '+test+' parameter');
        Void_Method_Without_Params();
    }

    public void Void_Method_Without_Params() {
        System.debug('DummyClass.Void_Method_Without_Params');
    }

    /* And lots of other static methods */
}
And such unit test:
@istest
public class MethodCalls {
    
    public static testmethod void Test_Inner_Static_Methods_Calls() {
        DummyClass obj=new DummyClass('Testing constructor');

        /* Lots of DummyClass static and instance methods calls */
    }

Global Trace for the user is set to DEBUG everywhere and for DummyClass it's set to FINEST everywhere.
Here's what I get in the debug log:
34.0 APEX_CODE,DEBUG;APEX_PROFILING,DEBUG;CALLOUT,DEBUG;DB,DEBUG;SYSTEM,DEBUG;VALIDATION,DEBUG;VISUALFORCE,DEBUG;WORKFLOW,DEBUG
06:23:02.0 (64084)|EXECUTION_STARTED
06:23:02.0 (136558)|CODE_UNIT_STARTED|[EXTERNAL]|01p36000001UZUF|MethodCalls.Test_Inner_Static_Methods_Calls
06:23:02.0 (8498670)|USER_DEBUG|[55]|DEBUG|Called DummyClass constructor with Testing constructor parameter
06:23:02.0 (8595762)|PUSH_TRACE_FLAGS|[56]|01p36000001UXWj|DummyClass|APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,FINEST;DB,FINEST;SYSTEM,FINEST;VALIDATION,FINEST;VISUALFORCE,FINEST;WORKFLOW,FINEST
06:23:02.0 (8610577)|METHOD_ENTRY|[56]|01p36000001UXWj|DummyClass.Void_Method_Without_Params()
06:23:02.0 (8639280)|VARIABLE_SCOPE_BEGIN|[63]|this|DummyClass|true|false
06:23:02.0 (8695301)|VARIABLE_ASSIGNMENT|[63]|this|{"AutoField":1}|0x29c5dd7d
06:23:02.0 (8708182)|STATEMENT_EXECUTE|[63]
06:23:02.0 (8710219)|STATEMENT_EXECUTE|[64]
06:23:02.0 (8712590)|LIMIT_USAGE|[64]|SCRIPT_STATEMENTS|10|200000
06:23:02.0 (8719003)|HEAP_ALLOCATE|[64]|Bytes:37
06:23:02.0 (8737361)|SYSTEM_METHOD_ENTRY|[64]|System.debug(ANY)
06:23:02.0 (8754229)|USER_DEBUG|[64]|DEBUG|DummyClass.Void_Method_Without_Params
06:23:02.0 (8760422)|SYSTEM_METHOD_EXIT|[64]|System.debug(ANY)
06:23:02.0 (8766224)|METHOD_EXIT|[56]|01p36000001UXWj|DummyClass.Void_Method_Without_Params()
06:23:02.0 (8785480)|POP_TRACE_FLAGS|[56]|01p36000001UXWj|DummyClass|APEX_CODE,DEBUG;APEX_PROFILING,DEBUG;CALLOUT,DEBUG;DB,DEBUG;SYSTEM,DEBUG;VALIDATION,DEBUG;VISUALFORCE,DEBUG;WORKFLOW,DEBUG
As you may notice in the line below:
06:23:02.0 (8498670)|USER_DEBUG|[55]|DEBUG|Called DummyClass constructor with Testing constructor parameter
There's a direct User_Debug entry - without any PUSH_TRACE_FLAGS, Method/Constructor entries, statement executes and so on. So this means that all the code in the DummyClass constructor was executed with the DEBUG level. However when constructor calls another method - everything gets fine and FINEST levels are applied for that method, but nor for the constructor...
The same applies for a static constructors.

I've tried to search for this in the Known Bugs, but no luck.
Any ideas how to workaround this (without changing the code itself) or how to bring SF's attention to fix this issue?

Thanks,
Vladimir
 
follow up to https://developer.salesforce.com/forums/?id=906F0000000BR44IAG

I've downloaded the Apex Debugging Tool for Eclipse (Kepler) IDE, and am unable to debug our org. Instead, I get the message:

I'm getting the following error:
"Encountered an error executing Apex Remote Debugger command
Either you or your organization don't have the permission to debug Apex."

I am not sure if debugging is a paid service, and if so, what exactly to check to see if my company should be getting this service.
  • August 14, 2015
  • Like
  • 0