What is the Log level that should be set to see user-generated debug statements?

  • By user-generated debug statements, you were referring to System.debug() calls in Apex methods, correct? – martin Dec 2 '15 at 9:09
  • yes, I was confuse between WARN and Debug . But i thing WARN can not be used for user generated debug statements – piyush Dec 2 '15 at 9:15
  • True. Warn does not display USER_DEBUG statements. Basically all you will get there are workflows, validation rules, and triggers (but not other classes that they call). – martin Dec 2 '15 at 9:18

You can see user debug statements with log level "Debug" or higher:

Debug, Fine, Finer, Finest, Internal.

You don't see user debug statements in levels "Info" or lower:

Info, Warn, Error

  • 1
    to avoid lots of noise in the debug logs; do what @sfdcfox suggests -- System.debug(LoggingLevel.INFO,'mymsg'); or use LoggingLevel.WARN or LoggingLevel.ERROR and then set your log filters in DC to Apex Code = INFO (or WARN or ERROR) and System = Error. You'll have shorter logs that are way easier to read – cropredy Dec 2 '15 at 17:54
  • 2
    This answer is not correct. You can see USER_DEBUG messages at any level above NONE, as long as the System.debug statement is specified as equal to or higher than the current logging level. – sfdcfox Dec 3 '15 at 18:19
  • In case it wasn't clear, I was referring to only the user debug statements generated from the single parameter version of system.debug() – martin Dec 3 '15 at 18:45

The minimum value to see any debug logs is a System level of ERROR, but most people only use the default logging level, so the usual recommendation is DEBUG. To debug at a lower level than debug, use the two parameter version of System.debug:

System.debug(LoggingLevel.ERROR, somemessage);

Also note, logs over 2mb may be truncated, including your debug messages.

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.