4

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

3
  • By user-generated debug statements, you were referring to System.debug() calls in Apex methods, correct?
    – martin
    Commented Dec 2, 2015 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
    Commented Dec 2, 2015 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
    Commented Dec 2, 2015 at 9:18

2 Answers 2

2

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

3
  • 2
    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
    Commented Dec 2, 2015 at 17:54
  • 3
    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
    Commented Dec 3, 2015 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
    Commented Dec 3, 2015 at 18:45
8

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 20mb may be truncated, including your debug messages.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .