Gestión de errores

From Dolibarr ERP CRM Wiki
Revision as of 07:59, 8 April 2009 by Simnandez (talk | contribs)
Jump to navigation Jump to search

Las funciones

La siguiente función le permite rastrear información en el archivo de registro Dolibarr dolibarr_syslog($message, LOG_INFO|LOG_DEBUG|LOG_ERR);

La siguiente función provoca un mensaje de error dolibarr_print_error($db,texte)

Módulo Syslog

El módulo informe de errores está integrado en las herramientas de administración de Dolibarr y le permite configurar el nivel de errores al que le gustaría que se le informara y cuando informarle.

Para llegar a la página de configuración del módulo de informes de errores, vaya a Inicio, configuración, módulos, módulos complementarios y utilice el icono de la configuración del módulo de la pantalla: Syslogs.

Por supuesto, este módulo (Syslogs) debe de estar activado para su uso.

The facility option allows you to use pre-set facilities to log your errors. Facilities are a system-level feature to tell your syslog operator where this error comes from, to judge priority and all that. You can find more about this inside the PHP documentation for the openlog() function which is used inside the dolibarr_syslog() function: http://www.php.ne/openlog Really, you should leave it to LOG_USER unless you know exactly what you're doing.

The next option, file, allows you to choose a file in which you will store the logs. The path you will indicate there should be relative to the system root (/). If you live it as it is (default option dolibarr.log), it will likely be opened in several directories, depending on the directory you're executing the script from. Of course, to do that, your web server must have write permissions on the directory you are using.

Generally, the file facility will work more easily because it doesn't depend on your server configuration (or only for the directory that needs to be writeable).

Finally, the level of reporting is how many types of errors you want to report. LOG_DEBUG(7) is the strongest option, reporting pretty much everything that calls a dolibarr_syslog() function. LOG_EMERG(0) is the opposite, letting you see only the errors that would really block your system.

On a typical Linux install, the logs will then be available somewhere in /var/log/apache[2]/[dolibarr]-error.log. You can watch it live from the terminal by using:

 tail -f /var/log/apache2/dolibarr-error.log