Print this page

Setting trace flags on apex class , not generating debug logs

Knowledge Article Number 000240613
Description
There are sometimes when we set trace flags on any apex class or triggers, The debug logs are not being generated. To capture debug logs, we need to set trace flags both at the user and class.
Resolution

When trace flag is set on the apex class or trigger, This will only override the debug log levels set at the trace flag of the user. This means, To generate the debug logs, we need to set the trace flag at the user, then set the trace flag at the class or trigger. 

For example. Set the trace flag at the user with the below filters
35.0 APEX_CODE,NONE;APEX_PROFILING,FINEST;CALLOUT,NONE;DB,FINEST;SYSTEM,DEBUG;VALIDATION,NONE;VISUALFORCE,NONE;WORKFLOW,NONE   where every filter set as None.

Set trace flag for the trigger 
APEX_CODE,FINEST;APEX_PROFILING,FINEST;CALLOUT,NONE;DB,FINEST;SYSTEM,DEBUG;VALIDATION,NONE;VISUALFORCE
,NONE;WORKFLOW,NONE where APEX_CODE as FINEST and all the other filter as NONE.

Now reproduce the issue and capture the debug logs generated. We can only see the logs related to the trigger as the APEX_CODE on the trigger set as FINEST.

35.0 APEX_CODE,NONE;APEX_PROFILING,FINEST;CALLOUT,NONE;DB,FINEST;SYSTEM,DEBUG;VALIDATION,NONE;VISUALFORCE,
NONE;WORKFLOW,NONE
13:14:06.1 (1373772)|PUSH_TRACE_FLAGS|[EXTERNAL]|01qi00000Jlq|test|APEX_CODE,FINEST;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,
INFO;VISUALFORCE,INFO;WORKFLOW,INFO
13:14:06.1 (1830651)|USER_INFO|[EXTERNAL]|005i0000G6|ABCD@gmail.com|Pacific Standard Time|GMT-07:00
13:14:06.1 (1847691)|EXECUTION_STARTED
13:14:06.1 (1882830)|CODE_UNIT_STARTED|[EXTERNAL]|TRIGGERS


Reference :
https://help.salesforce.com/apex/HTViewHelpDoc?id=code_debug_log_classes.htm&language=en_US
https://help.salesforce.com/apex/HTViewHelpDoc?id=code_add_users_debug_log.htm&language=en_US
https://docs.releasenotes.salesforce.com/en-us/winter16/release-notes/rn_debugging_logging.htm





promote demote