Debugging and monitoring the process

Logs are used to record error and back-end processes that are running in the organization. They store the following process information:

  • Workflow and approval process
  • Assignment rules
  • Escalation rules
  • Auto-response rules
  • Apex Script errors
  • Resources used by Apex Script

Types of logs

There are two types of debug logs:

  • Debug log
  • System logs

Debug log

Debug logs are stored separately and can be retained. They are stored based on particular users only. We can download, view, and manage the debug log for users. At a time only 20 logs are permitted per user. There is a limit of 2 MB per log and 50 MB per organization.

To setup a debug log, navigate to Setup | Administration Setup | Monitoring | Debug Logs.

Debug log

Click on New and add the user name to monitor in the box. The limit for debug log is 20 logs per user.

Debug log

System logs

System logs record the overall system processes happening at the moment. They store the processes created by all the users. System logs are not stored anywhere.

To start the system log click on Your name | System log in the top header of the page.

System logs

The system log will pop up on screen. The system log will monitor things as long as they are open, whereas the debug log will record 20 logs irrespective of if it is opened or no.

Categories of logs

Every category has a different log level. To pinpoint to the exact level, we can filter the categories according to their levels. Every Apex class has its own category filter, which tells the debug log what to record. The log categories are as follows:

Log Category

Description

Database

The database is the lowest category in the log. It includes data manipulation language (DML) statements and inline SOQL or SOSL queries.

Workflow

The log for workflow rules, such as the rule name, the actions taken, and so on.

Validation

Validation category shows information about validation rules, such as the name of the rule, whether the rule evaluated true or false, and so on.

Callout

Callout stores the log for the response and the send request from API. This is useful when debugging issues related to using Force.com web services API calls.

Apex code

The category stores information about Apex code and can include information such as log messages generated by DML statements, inline SOQL or SOSL queries, the start and completion of any triggers, and the start and completion of any test method, apex classes, methods etc.

Apex profiling

It includes the limits for the namespace, the number of e-mails sent, the number of queries used, and so on.

Visualforce

Includes information about Visualforce events, including serialization and deserialization of the view state or the evaluation of a formula field in a Visualforce page.

System

Includes information about calls to all system methods such as the System.debug method.

Log levels in the system log console

Specific events are logged based on the combination of category and levels. Most events start being logged at the INFO level. The level is cumulative, that is, if we select FINE, the log will also include all events logged below the FINE level.

The log levels are listed from lowest to highest.

  • ERROR
  • WARN
  • INFO
  • DEBUG
  • FINE
  • FINER
  • FINEST

Not all events have all the log levels, however, most of them will have two or three log levels. We can choose what level of logs we want to record to check the finest code execution.

Using the debug log

We can use the debug log to monitor processes that can have more than one occurrence from the following, but not limited to, events:

  • A workflow is not working the way it should be
  • There is no or a wrong field update
  • The approval process is not assigning it to the correct user
  • There is an error in the Apex trigger
  • There is an e-mail alert on a workflow or approval, but we have not received the e-mail. We might want to check if it's firing the alert with the correct e-mail ID.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset