0% found this document useful (0 votes)
85 views3 pages

Debug Log

Debug logs can track events in an org, including database operations, system processes, errors, and more. They are generated when user-based trace flags are active, during Apex tests, or when code or API requests include debugging parameters. Debug logs have size limits and older entries may be truncated to make space for new ones.

Uploaded by

SantiagoCamargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views3 pages

Debug Log

Debug logs can track events in an org, including database operations, system processes, errors, and more. They are generated when user-based trace flags are active, during Apex tests, or when code or API requests include debugging parameters. Debug logs have size limits and older entries may be truncated to make space for new ones.

Uploaded by

SantiagoCamargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Debug Logs

Use debug logs to track events that occur in your org. Debug logs are generated when you have active
user-based trace flags, when you run Apex tests, and when executed code or API requests include
debugging parameters or headers.

USER PERMISSIONS NEEDED


To view, retain, and delete debug logs: View All Data

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:

 Database changes
 HTTP callouts
 Apex errors
 Resources used by Apex
 Automated workflow processes, such as:
o Workflow rules
o Assignment rules
o Approval processes
o Validation rules

NOTE The debug log does not include information from actions triggered by time-based workflows.

The system generates a debug log every time a transaction that is included in the defined filter criteria is
executed.

Transactions can be generated from the following:

 Salesforce user interface


 API
 executeanonymous calls
 Web services
 Email services

The filter criteria set for the user, the Developer Console, or the API header determine what is included in
the debug log.

NOTE Debug logs don’t include transactions that lead conversion triggers. For example, suppose that a converted lead
triggers a workflow rule. The debug log doesn’t show that this workflow rule fired.

The following are examples of when to use a debug log.

 As a developer creating a custom application, you can use the debug log to validate the application’s behavior.
For example, you can set the debug log filter to check for callouts. In the resulting debug log, you can view
information about the success and duration of those callouts.
 As an administrator for an org, you can use the debug log to troubleshoot when a user reports difficulty. Set a
trace flag on the user, ask the user to step through the problematic transaction, and then use the debug log to
view the system details.
 For user-based trace flags, enter Debug Logs in the Quick Find box, then click Debug Logs.
 For class-based trace flags, enter Apex Classes in the Quick Find box, click Apex Classes, click
the name of a class, then click Trace Flags.
 For trigger-based trace flags, enter Apex Triggers in the Quick Find box, click Apex Triggers,
click the name of a trigger, then click Trace Flags.

Debug Log Limits


Debug logs have the following limits.

 Each debug log must be 20 MB or smaller. Debug logs that are larger than 20 MB are reduced in size by
removing older log lines, such as log lines for earlier System.debug statements. The log lines can be removed
from any location, not just the start of the debug log.
 System debug logs are retained for 24 hours. Monitoring debug logs are retained for seven days.
 If you generate more than 1,000 MB of debug logs in a 15-minute window, your trace flags are disabled. We
send an email to the users who last modified the trace flags, informing them that they can re-enable the trace
flag in 15 minutes.
 When your org accumulates more than 1,000 MB of debug logs, we prevent users in the org from adding or
editing trace flags. To add or edit trace flags so that you can generate more logs after you reach the limit, delete
some debug logs.

Debug Log Truncation


To provide the most pertinent information, debug logs are truncated, usually starting with older log entries. The newest
log entries are always preserved. 200 KB of the debug log are deleted when the log reaches its maximum size of 20
MB.

The following events are necessary for processing the debug log, so they’re not deleted during truncation.

 EXECUTION_STARTED
 EXECUTION_FINISHED
 CODE_UNIT_STARTED
 CODE_UNIT_FINISHED
 METHOD_ENTRY
 METHOD_EXIT
 CONSTRUCTOR_ENTRY
 CONSTRUCTOR_EXIT
 SOQL_EXECUTE_BEGIN
 SOQL_EXECUTE_END
 SOSL_EXECUTE_BEGIN
 SOSL_EXECUTE_END
 CALLOUT_REQUEST
 CALLOUT_RESPONSE
 FATAL_ERROR

NOTE Log entries for events that are necessary for processing the debug log aren’t truncated. However, other log
information that appears between the start and end lines of these log entries is removed during log truncation.
 Debug Log Details
A debug log includes a header, execution units, code units, log lines, and other log data.
 Debug Log Order of Precedence
Which events are logged depends on various factors. These factors include your trace flags, the
default logging levels, your API header, user-based system log enablement, and the log levels set
by your entry points.
 Debug Log Levels
To specify the level of information that gets included in debug logs, set up trace flags and debug
levels. The debug levels assigned to your trace flags control the type and amount of information
that is logged for different events. After logging has occurred, inspect debug events in your debug
logs.
 Searching a Debug Log
To search for text in a debug log, use the Command Line Window in the Developer Console.
 Delete Debug Logs
When your org accumulates too many debug logs, delete some or all of your system logs and
monitoring logs. Use the Developer Console’s Query Editor to find and delete the logs using
Tooling API.
 Debug Log Filtering for Apex Classes and Apex Triggers

Debug Log Categories


Log category
The type of information logged, such as information from Apex or workflow rules.
LOG CATEGORY DESCRIPTION
Includes information about database activity, including every data manipulation
Database language (DML) statement or inline SOQL or SOSL query.
Includes information for workflow rules, flows, and processes, such as the rule name
Workflow and the actions taken.
Includes information about Einstein Next Best Action activity, including strategy
NBA execution details from Strategy Builder.
Includes information about validation rules, such as the name of the rule and
Validation whether the rule evaluated true or false.
Includes the request-response XML that the server is sending and receiving from an
external web service. Useful when debugging issues related to using Lightning
Platform web service API calls or troubleshooting user access to external objects via
Callout Salesforce Connect.
Includes information about Apex code. Can include information such as log
messages generated by DML statements, inline SOQL or SOSL queries, the start
Apex Code and completion of any triggers, and the start and completion of any test method.
Includes cumulative profiling information, such as the limits for your namespace and
Apex Profiling the number of emails sent.
Includes information about Visualforce events, including serialization and
deserialization of the view state or the evaluation of a formula field in a Visualforce
Visualforce page.
Includes information about calls to all system methods such as
System the System.debug method.

Debug Log Levels


Log level
The amount of information logged. Not all levels are available for all categories. Only the levels that correspond
to one or more events are available.

 NONE
 ERROR
 WARN
 INFO
 DEBUG
 FINE
 FINER
 FINEST

What is the minimum log level needed to see user -generated debug statements? DEBUG

You might also like