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


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?


  • 1
    Your right, it isn't very clear what Mode name true/false means. At a guess maybe it is related to with sharing or without sharing. Dec 6, 2012 at 0:43
  • I'm not sure on this, but I'd try playing with the logging level (finest) to see if you can get more definitive mode info.
    – Adam
    Dec 12, 2012 at 18:14

1 Answer 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.