Set system to debug mode

How to set TAO to debug for logging and troubleshooting.

When trying to track down an error you are having, it’s important to set your system to debug to increase the amount of information in your logs.

To do this you will need to SSH to your server, and then cd to where you have installed TAO. You will then edit config/generis.conf.php and make sure DEBUG_MODE is set to true as shown below:

// mode
define('DEBUG_MODE', true);

If you need more detailed logging, TAO has a logger which accepts a PSR-3 logger interface. The logger utilizes TaoMonoLog which is a wrapper for monolog. While there is backward compatability to common_log, through TaoLog this functionality is deprecated.

The logger can be configured in config/generis/log.conf.php, and contains several different examples. These examples can be used to configure various methods to stream logs to a file, web console, Slack, etc.

The logging levels utilized by the logger are as follows:

  • DEBUG (100): Detailed debug information.
  • INFO (200): Interesting events. Examples: User logs in, SQL logs.
  • NOTICE (250): Normal but significant events.
  • WARNING (300): Exceptional occurrences that are not errors. Examples:
    Use of deprecated APIs, poor use of an API, undesirable things that are not
    necessarily wrong.
  • ERROR (400): Runtime errors that do not require immediate action but
    should typically be logged and monitored.
  • CRITICAL (500): Critical conditions. Example: Application component
    unavailable, unexpected exception.
  • ALERT (550): Action must be taken immediately. Example: Entire website
    down, database unavailable, etc. This should trigger the SMS alerts and wake
    you up.
  • EMERGENCY (600): Emergency: system is unusable.

The following is an example of configuring config/generis/log.conf.php to send debug level logs to a file, in this case /var/www/html/tao/logs/test-log.log:

return new oat\oatbox\log\LoggerService(array(
    'logger' => array(
        'class' => \oat\oatbox\log\logger\TaoMonolog::class,
        'options' => array(
            'name' => 'tao',
            'handlers' => array(
                    'class' => \Monolog\Handler\StreamHandler::class,
                    'options' => array(
return new oat\oatbox\log\LoggerService();