How to use GLPI in Debug mode

Introduction

This feature is usefull for developers or during test phase, after initial installation.

In this mode:

  • PHP errors are display on the screen
  • information about script execution are printed on the bottom of the page : the session content, SQL query with errors…
  • PHP and SQL errors are record to log file

GLPI/Plugins develper can ask you to enable this mode to help you when you ask for support in the forums.

Activation from the interface

Requires a super-admin profile

GLPI ≤ 0.71

  • Menu Setup / General
  • Setup General tab
  • Use GLPI in Mode: Debug
  • Logs in files (SQL, email, cron…): Yes

GLPI ≥ 0.72

  • Menu Setup / General
  • Setup General tab
  • Logs in files (SQL, email, cron…): Yes
  • Menu Settings
  • Use GLPI in Mode: Debug
Activation using SQL

If you cannot use the GLPI interface, but you have a direct access to the database (phpMyAdmin, MySQL Query Browser, command line…):

GLPI ≤ 0.71

UPDATE glpi_config SET debug=2, use_errorlog=1;

GLPI ≥ 0.72

UPDATE glpi_config SET use_errorlog=1;
UPDATE glpi_users SET use_mode=2 WHERE name='glpi';
Errors retrival
  • PHP Errors are record in glpi/files/_log/php_error.log
  • SQL Errors are record in glpi/files/_log/sql_error.log

Sample:

2008-09-15 19:24:01
Warning(2): mysql_connect(): Access denied for user 'ocs'@'localhost' (using password: YES)
Backtrace :
/usr/share/glpi/inc/dbmysql.class.php:74        mysql_connect()
/usr/share/glpi/inc/ocsng.class.php:58          DBmysql->DBmysql()
/usr/share/glpi/inc/ocsng.function.php:3393     DBocs->DBocs()
/usr/share/glpi/inc/ocsng.function.php:3408     getDBocs()
/usr/share/glpi/inc/ocsng.function.php:318      checkOCSconnection()
/usr/share/glpi/inc/ocsng.function.php:1236     ocsManageDeleted()
/usr/share/glpi/inc/cron.class.php:223          cron_ocsng()
/usr/share/glpi/front/cron.php:71               Cron->launch()

Don't forget any line in you bug report, the “Backtrace” is really usefull.