[SalesForce] System.debug is not displaying output

I am unable to print the message in the with System.debug;

I given as

System.debug('Hello SFDC');

Best Answer

Messages logged via System.debug() don't appear along with the output of any test executions, VisualForce pages, etc. but are visible via debug logs. You'll need to enable debug logs for your user account before running the Apex code which triggers System.debug(), and then debug logs will be saved for the next 20 operations you perform, whether or not they cause any System.debug() calls.

Debug logs can be quite dense, and locating a specific piece of information in them can be difficult. I recommend making your System.debug() text very unique so you can easily search through the log. For example, instead of just debug logging an sObject ID, log it with some prefix (e.g., System.log('My object ID: ' + obj.id)) so you can search the log for that prefix (in this example case, you'd search for “My object ID:”).