Skip to content

Logging

Stephen Vickers edited this page Jun 26, 2020 · 6 revisions

The Util class includes a static property named logLevel which can be used to control the sending of log messages to the PHP error log. This property should be given one of four values defined as constants in the class:

Constant name Description
LOGLEVEL_NONE No log messages are recorded (this is the default setting)
LOGLEVEL_ERROR Only logs of errors are recorded
LOGLEVEL_INFO All error and information log messages are recorded
LOGLEVEL_DEBUG All log messages are recorded

By default, no messages are logged. To change this include a line such as the following before any messages or service requests are processed:

use ceLTIc\LTI\Util;

...

Util::$logLevel = Util::LOGLEVEL_DEBUG;

The following methods include logging events:

  • Tool->handleRequest:
    • details of the request received (LOGLEVEL_INFO)
    • reason for any error with the request (LOGLEVEL_ERROR)
  • 'Http\HttpMessage->send' (LOGLEVEL_INFO when successful, LOGLEVEL_ERROR when unsuccessful):
    • details of the request being sent (URL and and POST parameters or message body)
    • the response received (headers and any message body)
  • DataConnector\DataConnector sub-classes:
    • SQL statements executed (LOGLEVEL_DEBUG when successful, LOGLEVEL_ERROR when unsuccessful)

Debug-level logging is also enabled when the debugMode property of the Tool or Platform object in use is set to true. When enabled, this setting will override the currently defined log level. See the Usage section for more information.

Clone this wiki locally