I'm attempting to ascertain if a block of code is running in System mode via the Debug Logs
I have log entries which appear as such:
21:26:05.741 (2741491000)|SYSTEM_MODE_ENTER|true
..
..
21:26:05.741 (2741491000)|SYSTEM_MODE_EXIT|true
And
21:26:05.741 (2741491000)|SYSTEM_MODE_ENTER|false
..
..
21:26:05.741 (2741491000)|SYSTEM_MODE_EXIT|false
And on inspection these don't seem to clearly indicate when I am entering system mode or not.
Now, the salesforce documentation unhelpfully states that 'the Mode name' is logged with this line:
SYSTEM_MODE_ENTER Mode name System INFO and above
SYSTEM_MODE_EXIT Mode name System INFO and above
Which taken at face value means the mode name is 'true' or 'false' (?)
How should I interpret this? Is everything between 'SYSTEM_MODE_ENTER' & SYSTEM_MODE_EXIT in system mode, what does the 'true'/'false' mean?
Thanks.
Attribution to: Steven Herod
Possible Suggestion/Solution #1
How should I interpret this? Is everything between 'SYSTEM_MODE_ENTER' & SYSTEM_MODE_EXIT in system mode, what does the 'true'/'false' mean?
I did some research this afternoon and believe I can provide an answer to this question.!
SYSTEM_MODE_ENTER|true
Means the debug log has entered into a mode for collecting information about all system methods such as the System.debug method. true
is a boolean. So if true
, then it's trying to collect information about system methods.
SYSTEM_MODE_ENTER|false
means exactly that! It did not enter into a mode to collect system method debug information. Similarly, SYSTEM_MODE_EXIT|false
means it did not exit the mode. In the above case, where both are false
, it makes perfect sense that a SYSTEM_MODE_EXIT
did not occur simply because it never entered into system mode to begin with!
System INFO and above
refers to the debug logging level setting that's required before SYSTEM_MODE_ENTER
and SYSTEM_MODE_EXIT
entries will be recorded in the debug log. In this case, it means that for either of these to be recorded in the debug log, the logging level has to be set for at least INFO
. It will continue to be recorded at any settings between INFO and FINEST
but will NOT be recorded at either WARN or ERROR
.
Attribution to: crmprogdev
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/5111