Mercurial > hg > nginx-site
annotate xml/en/docs/debugging_log.xml @ 1540:6866a74393e0
Added a hint about xslt transformation to autoindex_format.
author | Valentin Bartenev <vbart@nginx.com> |
---|---|
date | Wed, 24 Dec 2014 12:50:29 +0300 |
parents | 64ed0ce8ac5e |
children | 0108c6525d2a |
rev | line source |
---|---|
580
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
516
diff
changeset
|
1 <!-- |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
516
diff
changeset
|
2 Copyright (C) Igor Sysoev |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
516
diff
changeset
|
3 Copyright (C) Nginx, Inc. |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
516
diff
changeset
|
4 --> |
be54c443235a
Added copyright markers to documentation sources.
Ruslan Ermilov <ru@nginx.com>
parents:
516
diff
changeset
|
5 |
50 | 6 <!DOCTYPE article SYSTEM "../../../dtd/article.dtd"> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
7 |
123
7db449e89e92
Unified the use of the "name" attribute instead of "title".
Ruslan Ermilov <ru@nginx.com>
parents:
50
diff
changeset
|
8 <article name="A debugging log" |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
9 link="/en/docs/debugging_log.html" |
589 | 10 lang="en" |
1479
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
11 rev="4"> |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
12 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
13 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
14 <section> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
15 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
16 <para> |
213 | 17 To enable a debugging log, nginx needs to be configured to support |
18 debugging during the build: | |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
19 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
20 <programlisting> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
21 ./configure --with-debug ... |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
22 </programlisting> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
23 |
271 | 24 Then the <literal>debug</literal> level should be set with the |
213 | 25 <link doc="ngx_core_module.xml" id="error_log"/> directive: |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
26 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
27 <programlisting> |
213 | 28 error_log /path/to/log debug; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
29 </programlisting> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
30 |
213 | 31 The nginx binary version for Windows is always built with the debugging log |
271 | 32 support, so only setting the <literal>debug</literal> level will suffice. |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
33 </para> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
34 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
35 <para> |
271 | 36 Note that redefining the log without also specifying the |
37 <literal>debug</literal> | |
213 | 38 level will disable the debugging log. |
39 In the example below, redefining the log on the | |
40 <link doc="http/ngx_http_core_module.xml" id="server"/> | |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
41 level disables the debugging log for this server: |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
42 <programlisting> |
213 | 43 error_log /path/to/log debug; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
44 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
45 http { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
46 server { |
213 | 47 error_log /path/to/log; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
48 ... |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
49 </programlisting> |
213 | 50 To avoid this, either the line redefining the log should be |
271 | 51 commented out, or the <literal>debug</literal> level specification should |
213 | 52 also be added: |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
53 <programlisting> |
213 | 54 error_log /path/to/log debug; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
55 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
56 http { |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
57 server { |
213 | 58 error_log /path/to/log debug; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
59 ... |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
60 </programlisting> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
61 </para> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
62 |
1448
d3390895fe6e
Added subchapter in the "Debugging log" article.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
589
diff
changeset
|
63 </section> |
d3390895fe6e
Added subchapter in the "Debugging log" article.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
589
diff
changeset
|
64 |
d3390895fe6e
Added subchapter in the "Debugging log" article.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
589
diff
changeset
|
65 |
d3390895fe6e
Added subchapter in the "Debugging log" article.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
589
diff
changeset
|
66 <section id="clients" name="Debugging log for selected clients"> |
d3390895fe6e
Added subchapter in the "Debugging log" article.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
589
diff
changeset
|
67 |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
68 <para> |
516
8e1356bd281a
Documented the "debug_connection" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
69 It is also possible to enable the debugging log for |
8e1356bd281a
Documented the "debug_connection" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
70 <link doc="ngx_core_module.xml" id="debug_connection">selected |
8e1356bd281a
Documented the "debug_connection" directive.
Ruslan Ermilov <ru@nginx.com>
parents:
271
diff
changeset
|
71 client addresses</link> only: |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
72 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
73 <programlisting> |
213 | 74 error_log /path/to/log; |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
75 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
76 events { |
213 | 77 debug_connection 192.168.1.1; |
78 debug_connection 192.168.10.0/24; | |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
79 } |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
80 </programlisting> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
81 </para> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
82 |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
83 </section> |
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
84 |
1449
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
85 |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
86 <section id="memory" name="Logging to a cyclic memory buffer"> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
87 |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
88 <para> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
89 The debugging log can be written to a cyclic memory buffer: |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
90 <programlisting> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
91 error_log memory:32m debug; |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
92 </programlisting> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
93 Logging to the memory buffer on the <literal>debug</literal> level |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
94 does not have significant impact on performance even under high load. |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
95 In this case, the log can be extracted using |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
96 a <command>gdb</command> script like the following one: |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
97 <example> |
1479
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
98 set $log = ngx_cycle->log |
1449
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
99 |
1479
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
100 while $log->writer != ngx_log_memory_writer |
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
101 set $log = $log->next |
1449
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
102 end |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
103 |
1479
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
104 set $buf = (ngx_log_memory_buf_t *) $log->wdata |
64ed0ce8ac5e
Fixed the gdb script for dumping in-memory debug log.
Valentin Bartenev <vbart@nginx.com>
parents:
1449
diff
changeset
|
105 dump binary memory debug_log.txt $buf->start $buf->end |
1449
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
106 </example> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
107 </para> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
108 |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
109 </section> |
c79501e16e26
Documented cyclic memory buffer support for error_log.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
1448
diff
changeset
|
110 |
0
61e04fc01027
Initial import of the nginx.org website.
Ruslan Ermilov <ru@nginx.com>
parents:
diff
changeset
|
111 </article> |