Logs are used to record error and back-end processes that are running in the organization. They store the following process information:
There are two types of debug logs:
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.
Click on New and add the user name to monitor in the box. The limit for debug log is 20 logs per user.
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.
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.
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 |
---|---|
The database is the lowest category in the log. It includes data manipulation language (DML) statements and inline SOQL or SOSL queries. | |
The log for workflow rules, such as the rule name, the actions taken, and so on. | |
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 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. | |
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. | |
It includes the limits for the namespace, the number of e-mails sent, the number of queries used, and so on. | |
Includes information about Visualforce events, including serialization and deserialization of the view state or the evaluation of a formula field in a Visualforce page. | |
Includes information about calls to all system methods such as the System.debug method. |
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.
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.
We can use the debug log to monitor processes that can have more than one occurrence from the following, but not limited to, events: