python - Nginx 调试日志记录级别

标签 python nginx uwsgi error-log

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

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

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

查看日志后,我对所看到的内容感到非常困惑。我目前将级别设置为调试

我如何配置设置,以便它告诉我问题是语法错误?

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

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 Debug模式,它会吃掉你的硬盘。 Nginx Debug模式日志的目的是调试 nginx 本身,而不是您的应用程序错误。

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

3) DO faq about uwsgi logs

关于python - Nginx 调试日志记录级别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38800991/

相关文章:

python - 使用查询在 Python 中使用 Flask 获取大数据并显示在 HTML 表中

nginx - 在 Ubuntu 10.04 上使用 Nginx 设置 Tornado 以供生产使用

nginx - 使用 UWSGI 和 NGINX 服务 Pyramid 应用程序

python - 未使用的变量错误,gem5

python - 如何解析xsd :dateTime format?

python - Numba 可以与 TensorFlow 一起使用吗?

Nginx 不区分大小写的 proxy_pass

nginx - 为什么在 Nginx 中使用 with return 指令时速率限制不起作用?

django - 使用 uWSGI 在 apache 上运行 django 应用程序

nginx+uWSGI : dynamic vs emperor mode