Mercurial > hg > nginx-site
view xml/cn/docs/debugging_log.xml @ 2940:eff433088019
Updated with Netcraft February 2023 Web Server Survey stats.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Wed, 01 Mar 2023 12:17:31 +0000 |
parents | 9934338f83af |
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>