Home > Blog > Debug Logs in SFDC

Debug Logs in SFDC

Debug Log A debug log can record database operations, system processes, and errors that occur when executing a transaction or running unit tests. Debug logs can contain information about:

  1. Apex Code
  2. Apex Profiling
  3. Callout
  4. Database
  5. System
  6. Validation
  7. Visualforce
  8. Workflow
Generate And View Debug Logs

Step 1. From Setup, enter  Debug logs.

Step 2.  To set the Debug Logs, click on new,

Step 3. Select User, Start Date and Expiration Date. Expiration date must be a future date and also select the debug level and than click on save button.

Step 4. How to view, download and delete debug logs.

Step 5. To view Debug logs, Let’s take an example of trigger to see back-end process.

trigger AccountTrigger on Account (before insert , before update){
	for(Account a:trigger.new)
			a.Description='New Description';

Flow of Execution

/* start execution */
trigger TriggerOne on Account (before insert){
public class ClassA{
	public static void MethodA(){
public class ClassB{
	public static void MethodB(){
		// code
public class ClassC{
	public static void MethodC(){
		// Some code
/* End execution */

Description of Log Category

Log category Description
Database Workflow Validation Callout Apex Code Apex Profile Visualforce System Information of Data manipulation language (DML). Information of workflow rules, process and flows. Information about validation rule. Includes request and response. Information of Apex Code. Profile information such as no of email sent. Information of  visualforce event. Information of system method such as system.debug method.
How to see logs in the Developer Console

Step1. You can use the Developer console and execute anonymous functionality for debugging. Example: Write this code in anonymous window and execute: list<Account>  listacc =[select id, name from account limit 10]; System.debug(‘AccountList’ + listacc);

Step 2. Click on log tab

Step 3. Open  log

Debug Logs Limitations 1.Each Debug log size is of 5 MB or smaller. If a Debug log is greater than 5 MB, then it’s size is reduced by removing older log lines, such as System.debug statements.

2.System debug log is retained for 24 hours. Monitoring debug logs are retained for seven days.

3. If Debug logs size is more than 250 MB in a 15-Minute Window your trace flags are disable to prevent user to add and edit trace flags. You can generate more logs once you reach a limit and before you edit trace flags, delete some debug logs. Each trace flags includes Start Date, Expiration Date  and debug level.

Enquire Now

lets get over a cup of coffee and discuss!

Page Name: