by Jackal Software

When errors go unnoticed until reported by users, the issues begin to add up and it's hard to get ahead of correcting them. With the Error Trap plugin, you can capture errors in SugarCRM and notify users to take action, helping your teams to manage any issues proactively versus reactively.

Free 30 day trial
Try it Now

By clicking you consent to share your profile with the developer

User and Developer Guide

General Concepts

Error Trap overrides the default Sugar Logger to create records in a new module called Error Logs. This allows more proactive tracking and resolution of issues within the CRM. Dashboards, Reports, and Workflows can be setup to allow the appropriate users to track Errors.
We advise against relying solely on email messages to alert users of errors. If the error is related to SMTP email connections then those messages will not be delivered.

Sample Dashboard

A simple List View dashboard may be used to keep track of new Error Log records. More complex report dashlets can also be configured to track Error Logs assignments and status.

errortrap_dashletsettings.png

errortrap_dashlet.png

Mass Delete

If a large number of logs have been created of a certain type we included a Mass Delete functionality for quickly removing Error Log records.

Note this permanently deletes records from the database and Global Search should not be enabled for the Error Log module

Developer Notes

Log Levels

Due to the very verbose nature of SugarLogs for certain levels Error Log records are only created for the following Sugar Log Levels:
  • error
  • fatal
  • security

Sugar Default Logs

All logs are still written to the sugarcrm.log file. Even if the threshold set in the Error Trap configuration is surpassed.

Additional Parameters

For default or custom logging using the $GLOBALS['log']->{level}('string') function additional parameters may be passed for more control.
For the Sugar Logger additional parameters are converted to an array when printed to the sugarcrm.log file.
For Error Trap, when calling this function the parameters are ('message' string, 'name' string, 'user_id' string, 'notify' bool);
  • message: If this is the only parameter then this value is set as the description field of the Error Log record and the name will be formatted as the log level + 'Log' + first 75 characters of the message.
  • name: If preset this is set as the name field of the Error Log record. Note that maximum records per interval are checked as exact match of the name field.
  • user_id: User ID to assign the Error Log record to.
  • notify: Create notification record and assign to the above user_id. Also saved the record with the email notification set to true which requires email notifications to be enabled.

Examples

Simple
$GLOBALS['log']->fatal('Error connecting to the new endpoint. Response Message {Service Not Available}');

errortrap_sample1.png

Extra Parameters
        $GLOBALS['log']->fatal(
            'An error was caught at custom/modules/Accounts/AccountBeforeSave.php:444. No matching records to link',
            'Code Error on Account Logic Hook',
            1,
            true
        );

errortrap_sample2.png

Saving Comment Saving Comment...
Rating