错误处理: Difference between revisions

Jump to navigation Jump to search
(initialization)
Tag: 2017 source edit
 
Line 4: Line 4:
{{TemplateDocDevZh}}
{{TemplateDocDevZh}}


= Functions =
=函数=
Following function allows to log informations in Dolibarr log file
在 Dolibarr 日志文件中记录日志信息的函数:
<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_syslog($message, LOG_DEBUG|LOG_INFO|LOG_WARNING|LOG_ERR);</syntaxhighlight>
<syntaxHighlight lang="php">dol_print_error($db,texte);</syntaxHighlight>


= Module Syslog =  
日志级别与 Syslog 模块(见下文)中定义的设置相关。
 
在屏幕上显示错误消息的函数(必须在从不到达的代码中保留使用):
 
<syntaxhighlight lang="PHP">dol_print_error($db,texte);</syntaxhighlight>
 
=Module 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.
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.


Line 30: Line 33:
More information on page [[Module Syslog (developer)]].
More information on page [[Module Syslog (developer)]].


= Webserver logs =
=Webserver logs=
== Apache ==
==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:
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>
<syntaxhighlight lang="bash">tail -f /var/log/apache2/dolibarr-error.log</syntaxhighlight>
== Nginx ==
==Nginx==
If you are using nginx to serve Dolibarr some useful debugging information is often to be found there.
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>
<syntaxhighlight lang="bash">tail -f /var/log/nginx/error.log</syntaxhighlight>
714

edits

Navigation menu