Mercurial > hg > nginx-site
view xml/cn/docs/debugging_log.xml @ 2846:fdf1464e1977
Moved banner to the external file to make partial rollout possible.
An idea is to have several banners and show them with different probability
specified by split directive in the nginx.conf
author | Sergey Budnevitch <sb@waeme.net> |
---|---|
date | Tue, 10 May 2022 18:07:27 +0400 |
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>