view xml/cn/docs/debugging_log.xml @ 720:9934338f83af

Updated the Chinese documentation.
author Ruslan Ermilov <ru@nginx.com>
date Thu, 11 Oct 2012 10:23:05 +0000
parents 149f54c158f0
children
line wrap: on
line source

<!--
  Copyright (C) Igor Sysoev
  Copyright (C) Nginx, Inc.
  -->

<!DOCTYPE article SYSTEM "../../../dtd/article.dtd">

<article name="调试日志"
         link="/cn/docs/debugging_log.html"
         lang="cn"
         rev="1">


<section>

<para>
要开启调试日志,首先需要在配置nginx时打开调试功能,然后编译:

<programlisting>
./configure --with-debug ...
</programlisting>

然后在配置文件中设置<literal>error_log</literal>的级别为<literal>debug</literal>:

<programlisting>
error_log  /path/to/log  debug;
</programlisting>

nginx的windows二进制版本总是将调试日志开启的,因此只需要设置<literal>debug</literal>的日志级别即可。
</para>

<para>
注意,重新定义错误日志时,如过没有指定<literal>debug</literal>级别,调试日志会被屏蔽。下面的例子里,在<link doc="http/ngx_http_core_module.xml" id="server"/>层中重新定义的日志就屏蔽了这个虚拟主机的调试日志:
<programlisting>
error_log  /path/to/log  debug;

http {
    server {
        error_log  /path/to/log;
        ...
</programlisting>
为了避免这个问题,注释这行重新定义日志的配置,或者也给日志指定<literal>debug</literal>级别:
<programlisting>
error_log  /path/to/log  debug;

http {
    server {
        error_log  /path/to/log  debug;
        ...
</programlisting>
</para>

<para>
另外,也可以只针对<link doc="ngx_core_module.xml" id="debug_connection">选定的客户端地址</link>开启调试日志:

<programlisting>
error_log  /path/to/log;

events {
    debug_connection   192.168.1.1;
    debug_connection   192.168.10.0/24;
}
</programlisting>
</para>

</section>

</article>