Skip to main content

Debugging is Force.com's way of printing the specified message, in string format, to the execution debug log with the specified log level. Called using System.debug which takes either single parameter of message or two parameters of message and log level.

Debugging is boon to the developers developing in Apex to print out any specified message to the execution debug log.

Types of Debug Statements:

1. System.debug(msg):

Here the parameter will be of any type which will be converted to String using String.valueOf() internally by Force.com run time engine. Here the log level is DEBUG.

2. System.debug(loglevel,msg):

Here the parameters will be of any type along with loglevel.

Valid log levels are (listed from lowest to highest):

  1. ERROR
  2. WARN
  3. INFO
  4. DEBUG
  5. FINE
  6. FINER
  7. FINEST

Calls to System.debug are not counted as part of Apex code coverage.