Nginx 调试日志级别

Nginx debugging logging levels

我按照 these 说明并在 nginx 中启用了错误日志。

我试图测试日志,我通过删除 for 循环末尾的 : 创建了一个语法错误。

尝试加载网站时,出现 500 内部服务器错误。

查看日志后,我对所看到的内容感到很迷茫。我目前将级别设置为 debug.

我该如何配置设置才能告诉我问题是语法错误?

这是错误日志尾部的示例:

5098 2016/08/06 01:53:05 [debug] 23526#23526: *44 write new buf t:1 f:0 0000559FAC0F0508, pos 0000559FAC0F0508, size: 161 file: 0, size: 0
5099 2016/08/06 01:53:05 [debug] 23526#23526: *44 http write filter: l:0 f:0 s:161
5100 2016/08/06 01:53:05 [debug] 23526#23526: *44 http output filter "/tag/getting-started/?"
5101 2016/08/06 01:53:05 [debug] 23526#23526: *44 http copy filter: "/tag/getting-started/?"
5102 2016/08/06 01:53:05 [debug] 23526#23526: *44 image filter
5103 2016/08/06 01:53:05 [debug] 23526#23526: *44 xslt filter body
5104 2016/08/06 01:53:05 [debug] 23526#23526: *44 http postpone filter "/tag/getting-started/?" 0000559FAC0F06E8
5105 2016/08/06 01:53:05 [debug] 23526#23526: *44 write old buf t:1 f:0 0000559FAC0F0508, pos 0000559FAC0F0508, size: 161 file: 0, size: 0
5106 2016/08/06 01:53:05 [debug] 23526#23526: *44 write new buf t:0 f:0 0000000000000000, pos 0000559FAB989AC0, size: 120 file: 0, size: 0
5107 2016/08/06 01:53:05 [debug] 23526#23526: *44 write new buf t:0 f:0 0000000000000000, pos 0000559FAB98ADA0, size: 62 file: 0, size: 0
5108 2016/08/06 01:53:05 [debug] 23526#23526: *44 http write filter: l:1 f:0 s:343
5109 2016/08/06 01:53:05 [debug] 23526#23526: *44 http write filter limit 0
5110 2016/08/06 01:53:05 [debug] 23526#23526: *44 writev: 343 of 343
5111 2016/08/06 01:53:05 [debug] 23526#23526: *44 http write filter 0000000000000000
5112 2016/08/06 01:53:05 [debug] 23526#23526: *44 http copy filter: 0 "/tag/getting-started/?"
5113 2016/08/06 01:53:05 [debug] 23526#23526: *44 http finalize request: 0, "/tag/getting-started/?" a:1, c:1
5114 2016/08/06 01:53:05 [debug] 23526#23526: *44 event timer add: 12: 5000:1470462790191
5115 2016/08/06 01:53:05 [debug] 23526#23526: *44 http lingering close handler
5116 2016/08/06 01:53:05 [debug] 23526#23526: *44 recv: fd:12 -1 of 4096
5117 2016/08/06 01:53:05 [debug] 23526#23526: *44 recv() not ready (11: Resource temporarily unavailable)
5118 2016/08/06 01:53:05 [debug] 23526#23526: *44 lingering read: -2
5119 2016/08/06 01:53:05 [debug] 23526#23526: *44 event timer: 12, old: 1470462790191, new: 1470462790191
5120 2016/08/06 01:53:05 [debug] 23526#23526: *44 http empty handler
5121 2016/08/06 01:53:05 [debug] 23526#23526: *44 http empty handler
5122 2016/08/06 01:53:05 [debug] 23526#23526: *44 http lingering close handler
5123 2016/08/06 01:53:05 [debug] 23526#23526: *44 recv: fd:12 -1 of 4096
5124 2016/08/06 01:53:05 [info] 23526#23526: *44 recv() failed (104: Connection reset by peer) while sending to client, client: 180.76.15.12, server: chriskoh.io, request: "GET /tag/getting-started/ HTTP/1.1", upstream: "http://127     .0.0.1:2368/tag/getting-started/", host: "sites.bugsplat.info"
5125 2016/08/06 01:53:05 [debug] 23526#23526: *44 lingering read: -1
5126 2016/08/06 01:53:05 [debug] 23526#23526: *44 http request count:1 blk:0
5127 2016/08/06 01:53:05 [debug] 23526#23526: *44 http close request
5128 2016/08/06 01:53:05 [debug] 23526#23526: *44 http log handler
5129 2016/08/06 01:53:05 [debug] 23526#23526: *44 free: 0000559FAC0F8BA0, unused: 0
5130 2016/08/06 01:53:05 [debug] 23526#23526: *44 free: 0000559FAC0EFB70, unused: 881
5131 2016/08/06 01:53:05 [debug] 23526#23526: *44 close http connection: 12
5132 2016/08/06 01:53:05 [debug] 23526#23526: *44 event timer del: 12: 1470462790191
5133 2016/08/06 01:53:05 [debug] 23526#23526: *44 reusable connection: 0
5134 2016/08/06 01:53:05 [debug] 23526#23526: *44 free: 0000559FAC0EE400
5135 2016/08/06 01:53:05 [debug] 23526#23526: *44 free: 0000559FAC0EE1F0, unused: 128

1) 禁用 nginx 调试模式,它会吃掉你的硬盘。 Nginx 调试模式日志的目的是调试 nginx 本身,而不是你的应用程序错误。

2) 不要在错误的地方查找错误,nginx 错误日志与您的应用程序(烧瓶)/中间件(在您的情况下为 uwsgi)日志无关

3) DO faq about uwsgi logs