Introduction to Sugar Logging
Overview
Sugar has the ability to constantly log information about its actions depending on the logging level the administrator has chosen. When an issue or unexpected behavior is encountered while using Sugar, the Sugar log can be a valuable source of insight. While it is recommended to leave the logging level at "Fatal" for daily use, the level can be adjusted as necessary when attempting to troubleshoot a particular issue.
Note: This article pertains to on-site Sugar installations. The Logger Settings panel is hidden for instances on Sugar's cloud service. Should you require a temporary log-level adjustment in a production instance that is hosted in Sugar's cloud environment, you must open a support case. For more information about default configuration settings for SugarCloud environments, please refer to the SugarCloud Policy Guide.
Logging Levels
The logging levels in order of most verbose to least are as follows:
- Debug: Logs events that help in debugging the application.
- Info: Logs informational messages and database queries.
- Warn Logs potentially harmful events.
- Deprecated: Logs warning messages to inform administrators of code that will be deprecated in a future release.
- Note: If you have any customizations utilizing this code, it would be good to edit the code to avoid any issues with your customizations later.
- Error: Logs error events in the application.
- Fatal: Logs severe error events that lead the application to abort. This is the default level.
- Security: Logs events that may compromise the security of the application.
- Off: The logger will not log any events.
When you specify a logging level, the system will record messages for the specified level as well as all higher levels. For example, if you specify "Error", the system records all "Error", "Fatal", and "Security" messages.
Note: The verbosity of higher levels of logging can impact the performance of your Sugar instance. We do not recommend leaving the log level any higher than the default Fatal level unless actively troubleshooting an issue.
Using Sugar Logging
Adjusting the Log Level
You can adjust your logging level by using the following steps:
- Navigate to Admin > System Settings.
- Scroll down to the Logger Settings section.
- Select your desired option in the Log Level dropdown.
- Click "Save" to activate the new logging level.
Viewing the Log
You can view the log through Sugar using the following steps:
- Navigate to Admin > System Settings.
- Scroll down to the Logger Settings section.
- Click "View Log".
- In order to see all of the current logging file, click "All".
- After resolving your issue, return to the System Settings page, and change the log level back to "Fatal".
Log Viewing Options
In addition to viewing all of the current log file's contents, the following buttons and options are available for narrowing down the displayed messages:
- Search: Enter a string in the search box to show only messages containing the given string.
- Reg Exp: Check this box when you are using a regular expression as your search string.
- Ignore Self: Check this box to hide log entries for requests initiated by your IP address.
- Next: Click this button to view only new log entries that have not yet been displayed.
- Mark Point: Click this button to mark the beginning point in time for a subset of logging that you would like to view.
- Refresh From Mark: After allowing some time to pass or performing a problematic action since clicking "Mark Point", click "Refresh From Mark" to see the messages since logged.
Alternative Log Access
Sugar also stores log files in the root directory of the application. The name of this file is controlled by the "Log File Name", "Extension", and "Append after filename" parameters from System Settings (e.g., sugarcrm_08_2012.log). To view the contents of the log file, you can either view it directly via the file system (On-Site instances only) or you can run the Diagnostic Tool and download its results, which include the log file, to your computer. For more information regarding the diagnostic tool in Sugar, please refer to the Introduction to the Diagnostic Tool article.
To run the diagnostic tool, use the following steps below:
- Navigate to Admin > Diagnostic Tool.
- Uncheck all options except for "SugarCRM Log File".
- Click the Execute Diagnostic button.
- Click the "Download the Diagnostic file" link to download the file.
- Next, click the "Delete the Diagnostic file" link.
- Finally, unzip the downloaded file to review the log file.