Debugging Reports

Download this manual as a PDF file

This section describes the logging options that are available to report and widget developers. Logging can be enabled on any appliance that provides the user interface (Administration Portals, Database Servers, and All-In-One Appliances). When logging is enabled on an appliance:

  • As a user navigates the user interface on that appliance, the ScienceLogic user interface code will write messages to the user interface log file.
  • When reports are generated on the appliance, reports that are configured to log messages will write to the user interface log file.
  • When widgets are loaded in the user interface of the appliance, widgets that are configured to log messages will write to the user interface log file.

Use the following menu options to navigate the SL1 user interface:

  • To view a pop-out list of menu options, click the menu icon ().
  • To view a page containing all of the menu options, click the Advanced menu icon ().

Log rotation is not enabled on the log files described in this chapter. The log files described in this chapter can cause the file system to become full if they remain enabled for a long period of time. Do not leave the log files described in this chapter enabled unless you are actively debugging a problem with the user interface, a report, or a widget.

Controlling Log Settings

In rare cases, you may need to modify log levels or suppression of certain logs in SL1, usually at the request of ScienceLogic Customer Support. To do so, you will navigate to the PHP Developer Logs page (System > Tools > PHP Developer Logs). This section describes the options included on the PHP Developer Logs page.

This page is is only available for Administrator-level users in SL1.

Setting UI Developer Log Levels

When configuring logging on an appliance, you must specify a log level. The log level controls the types of messages that are written to the user interface log file (em7php.log). Each type of message has an associated number; the log level is the sum of all enabled messages. The numbers and associated message types are:

  • 1. Critical
  • 2. Error
  • 4. Warning
  • 8. Info
  • 16. Debug
  • 32. Trace

To determine the log level, sum the numbers associated with each type of message you want to enable. For example, if you want to enable Critical, Error, and Warning messages, you would sum one, two, and four to get a log level value of seven.

Setting UI/REST MySQL Query Log Levels

The UI/REST MySQL Query Log Levels settings let you specify the log level for the mysqli.log file. This log file collects every PHP-based call to MySQL and includes general information about the query. Determine the granularity of data you want and select one or more checkboxes.

  • Error
  • Warning
  • Info (non-error)

In addition, if you select the Request URI option, the mysqli.log file will include the request URI.

Configuring Advanced Log Settings

In the Advanced Settings section, you can configure the suppressions and the date/time format you want to use:

  • Suppression List. This list acts as a bitmask to log entries. For example, to suppress all entries for css-em7, you would enter "css.em7::127", where 127 is the sum of all possible log levels. You can specify multiple suppressions in the list, separated by commas.

  • Datetime Format. Specifies a user-defined date format that will be used for5 system logs. You can use any date variables supported by the PHP date function in this field.

    Seconds and milliseconds are always appended to the date/time stamp.

  • Include IP in log filenames. Select this option to add the IP address from which the user is logged in to the name of each log file.

The following video explains a new method for accessing user interface logs:

Writing to the Log File

PHP code for reports and widgets can write messages to the log file by using one of the following functions. Although these functions can be called at any time, messages will be written to the log file only if logging is configured with a log level that includes the message type created by the function. Each function takes one parameter, a message string (denoted by $msg) to be written to the log file:

  • To write a log message of type "Critical", use the following function:
  • devlog::crit($msg);

  • To write a log message of type "Error", use the following function:
  • devlog::err($msg);

  • To write a log message of type "Warning", use the following function:
  • devlog::warn($msg);

  • To write a log message of type "Info", use the following function:
  • devlog::inf($msg);

  • To write a log message of type "Debug", use the following function:
  • devlog::dbg($msg);