Administrator Guide (Package Version 1.2.0)
App’s installation is prerequisite for its use. If you have not installed and configured sLog general settings, please refer to the installation guide.
Table of Contents
With sLog you can log standard automation errors as well as Apex errors. Just by installing the app, you will immediately log errors coming from Visual flows and Process builders. It’s also possible to log Apex errors by adding a quick configuration in the Apex code.
Below, the various automated processes supported by sLog and their configuration if necessary.
1. Standard Automation Processes
After installation and configuration of the application, all logs on the processes below will be created automatically :
- Visual Flow Error
- Process Builder Error
- Platform Status Alert
Visual Flow Errors
Errors will generate a persistant log with the “FlowException” record type:
Process Builder Errors
When a process builder failed, the same log will be created with the record type “ProcessBuilderException” :
Platform Status Alert
Slog will also generate logs of all alerts that occur during the processing of a user request or service job execution.
2. APEX Processes
To log APEX processes, you have to perform a quick configuration on your apex code.
Apex Batch Error
sLog also allow to log easily any batch job using the batch event platform.
On the declaration of your batches add :
Now when a batch will fail, a log will be created with the record type “BatchException”:
Exceptions are used in try/catch parts of code. If you want to generate a log in any of your try/catch, you can use the following signature:
This will create a Log record with the “TryCatchException” RecordType.
The default log level is « ERROR » but you can also define it using the following method :
Advice : if you have multiple logs for one transaction:
If you have multiples logs for a given transaction you wont create logs one by one but rather all at the same time.
For that we have three other methods you can use:
- The isBulk parameter allow to delay the creation of a single log and at the end of the transaction
- You have to use the writeBulk() method to create all the logs at once.
So if you are in a for/while loop, be sure to use the method with the “isBulk” parameter to true.
Http Request Error
You can use sLog to log any of your http request using the following methods:
You just have to put the request and the response (both are not mandatory but it’s best to have both) in the write method and it will be parsed correctly and create a log record with “HttpRequest” RecordType.
The log created will have :
– All the parameters of the sent request (exept the header because it can contain sensitive information)
– All the parameters of the response, exept the header.
The default log level is “DEBUG” and can be overridden. The isBulk parameter is used the same as for the Exceptions, just don’t forget to use the method at the end of the loop to write all the log at once.
Add informations on your Log records
In addition if you need to add some informations about the process/class/method, you can use one of the four other method below :
Those methods works exactly the same as the four firsts methods they just allow you to precise some informations on your log.
The trace can be used to monitor if your code went to a certain point at certain time, and confirm it went through a defined process. Anywhere else in your org you can use the following methods to create a trace log with custom messages :
A log will be created with “Trace” RecordType and the default log level is “INFO”.
Another type of log we provide is the database log. This is used anytime you can use a database.saveResult. You can use it with an array of saveResult or a single saveResult. It will log the errors generated by the DML operation.
Methods are the following:
If any of your Database action is inside a loop for any reason you will have to use the method with the “isBulk” parameter to true and use the method at the end of the loop to write all the log at once.
Out of the box Reports are available and others can be made to monitor the processes you want to have a closer control on.
SLog comes with a simple dashboard with integrated reports that count the différents types of logs. You can exclude any log from one of our report by checking the « Archived » Checkbox on the Log record.
4. Watch our video to see How does it works