Line 1:
Line 1:
−
The error reporting module is integrated in the Dolibarr administration tool and allows you to configure what level of errors you would like to be reported and where.
+
<!-- BEGIN origin interlang links -->
+
<!-- You can edit this section but do NOT remove these comments
+
Links below will be automatically replicated on translated pages by PolyglotBot -->
+
[[fr:Gestion_d'erreur]]
+
[[es:Gestión_de_errores]]
+
[[zh:错误处理]]
+
<!-- END interlang links -->
−
To get to the error reporting module configuration page, go to Home, Configuration, Modules and use the configuration icon of the last module on the screen: "System logs".
+
[[Category:Core]]
+
{{TemplateDocDevEn}}
−
The "facility" option allows you to use pre-set facilities to log your errors in. For example:
+
= Functions =
−
* the default "LOG_USER" allows you to record the errors in ...
+
Following function allows to log informations in Dolibarr log file
+
<syntaxHighlight lang="php">dol_syslog($message, LOG_DEBUG|LOG_INFO|LOG_WARNING|LOG_ERR);</syntaxHighlight>
+
The log level is related to setup defined in module Syslog (see lower).
+
Following function can be used to add error information on screen. Usage must be reserved in never reached code.
+
<syntaxHighlight lang="php">dol_print_error($db,texte);</syntaxHighlight>
−
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 Dolibarr root.
+
= Module Log Debug (also called Syslog) =
+
The error reporting module is integrated with other Dolibarr modules. It allows you to configure what level of errors you would like to be reported and where.
−
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.
+
To get to the error reporting module configuration page, go to Home, Configuration, Modules and use the configuration icon of the last module on the screen: ''Syslog''.
+
+
Of course, this module ('''Syslog''') must be activated for the following to work.
+
+
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 ''dol_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 DOL_DOCUMENT_ROOT/dolibarr.log), it will likely be opened in document directory. 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 writable).
+
+
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 dol_syslog() function. LOG_EMERG(0) is the opposite, letting you see only the errors that would really block your system.
+
+
More information on page [[Module Syslog (developer)]].
+
+
= Webserver logs =
+
== Apache ==
+
Note that you can have also find some technical PHP/Apache errors in apache log file (whatever is status/setup of this module). But this occurs only if there is a technical problem in your installation: On a typical Linux install, such logs will be available somewhere in '''/var/log/apache[2]/[dolibarr]-error.log'''. You can watch it ''live'' from the terminal by using:
+
<syntaxHighlight lang="bash">tail -f /var/log/apache2/dolibarr-error.log</syntaxHighlight>
+
== Nginx ==
+
If you are using nginx to serve Dolibarr some useful debugging information is often to be found there.
+
<syntaxHighlight lang="bash">tail -f /var/log/nginx/error.log</syntaxHighlight>