错误处理: Difference between revisions

Jump to navigation Jump to search
m (Adding interlang links (links to translated versions of this page in other languages) triggered by origin English page "Error_reporting" update.)
Line 7: Line 7:
[[es:Gestión_de_errores]]
[[es:Gestión_de_errores]]
<!-- END interlang links -->
<!-- END interlang links -->


[[Category:Core]]
[[Category:Core]]
Line 24: Line 23:
<syntaxhighlight lang="PHP">dol_print_error($db,texte);</syntaxhighlight>
<syntaxhighlight lang="PHP">dol_print_error($db,texte);</syntaxhighlight>


=Module Syslog=  
=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.
跟踪模块包含在Dolibarr的其他可管理模块中,允许您启用/更改要查看的错误级别。
 
要访问此模块的配置页面,请转到 '''主页->设置->模块/应用''',然后单击syslog'''调试日志'''模块行行末尾的齿轮图标。


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''.
当然,必须启用此模块('''Syslog''')才能进行跟踪工作。


Of course, this module ('''Syslog''') must be activated for the following to work.
'''Syslog''' 的 '''facility''' 选项是用于记录消息的预定义配置概念。这是一个系统功能,用于告诉系统操作员错误来自何处(此处为dolibarr),并指示其优先级。您可以在PHP文档中找到''dol_syslog()''函数中使用的''openlog()''函数的更多信息:http://www.php.ne/openlog


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
通常,除非您知道自己在做什么,否则应将此值保留为 '''LOG_USER''' 。
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.
下一个选项 '''file''' 允许您选择要保存日志的文件。指定的路径必须相对于根(/)目录。如果保持原样(默认选项DOL_DOCUMENT_ROOT/dolibarr.log),它将在 Dolibarr 的 documents 目录中创建。当然,要做到这一点,您的web服务器必须对该目录具有写入权限。


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).
通常,'''file''' 设施将更频繁地工作,因为它不依赖于服务器的系统配置,也不依赖于可能需要的syslog守护进程(唯一可能发生的问题是web服务器没有对目录的写入权限)。


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.
最后,日志级别表示您希望看到多少种类型的消息。LOG_DEBUG(7) 是最详细的选项,它会打印通过dol_syslog()函数传递的任何消息。LOG_EMERG(0) 正好相反,只跟踪严重错误的消息。


More information on page [[Module Syslog (developer)]].
有关更多详情,请参阅 [[Module Syslog (developer)]] 页面。


=Webserver logs=
=Webserver logs=
714

edits

Navigation menu