function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sandip458Sandip458 

How to view the variable value using System.debug in apex class

Hello All,

 

Like in java if we want to see the variable value while debuging  the code or after running the application

 

we put System.out.println('') statement to monitor the value on console.

 

In Apex how to monitor this value using System.debug since we dont have console here..

 

Can anybody tell me the way with simple example i.e Class with the only System.debug statement.

 

 

Thanks,

Sandip

 

Best Answer chosen by Admin (Salesforce Developers) 
alexf99alexf99

Hi Sandip,

 

You simply include a line such as

 

System.debug('The value is: ' + theValue);

 

And then in your sidebar, under Administration go to Monitoring -> Debug Logs. You have to click on 'new' and add the user as whom the script will be running in order to capture the log output. Then after running the code, refresh the logs list and view the log to see the output.

 

Regards,

 

Alex 

All Answers

alexf99alexf99

Hi Sandip,

 

You simply include a line such as

 

System.debug('The value is: ' + theValue);

 

And then in your sidebar, under Administration go to Monitoring -> Debug Logs. You have to click on 'new' and add the user as whom the script will be running in order to capture the log output. Then after running the code, refresh the logs list and view the log to see the output.

 

Regards,

 

Alex 

This was selected as the best answer
Janakiraman ElumalaiJanakiraman Elumalai
Hi Alex,
Super!! Thanks.
Sunil Shah 8Sunil Shah 8
Thanks Alex :)