您的位置:首页 > 运维架构 > Apache

Django+Apache 报 [wsgi:error]问题解决

2017-09-28 14:54 375 查看
环境:CentOS6.7 + Apache2.4 + Django1.8

背景:早前对apache日志按天进行了分割,每天日志文件大小很稳定。最近发现apache错误日志文件巨大,每天都打印很多很多行[wsgi:error]

[plain] view
plain copy

[Mon Dec 26 08:24:58.245875 2016] [wsgi:error] [pid 24768:tid 140371390662400] 17  

[Mon Dec 26 08:24:58.245891 2016] [wsgi:error] [pid 24768:tid 140371390662400] 16  

[Mon Dec 26 08:24:58.245906 2016] [wsgi:error] [pid 24768:tid 140371390662400] 15  

[Mon Dec 26 08:24:58.245922 2016] [wsgi:error] [pid 24768:tid 140371390662400] 14  

[Mon Dec 26 08:24:58.245937 2016] [wsgi:error] [pid 24768:tid 140371390662400] 13  

[Mon Dec 26 08:24:58.245953 2016] [wsgi:error] [pid 24768:tid 140371390662400] 12  

[Mon Dec 26 08:24:58.245969 2016] [wsgi:error] [pid 24768:tid 140371390662400] 11  

[Mon Dec 26 08:24:58.245984 2016] [wsgi:error] [pid 24768:tid 140371390662400] 10  

[Mon Dec 26 08:24:58.246000 2016] [wsgi:error] [pid 24768:tid 140371390662400] 9  

[Mon Dec 26 08:24:58.246015 2016] [wsgi:error] [pid 24768:tid 140371390662400] 8  

[Mon Dec 26 08:24:58.246031 2016] [wsgi:error] [pid 24768:tid 140371390662400] 7  

[Mon Dec 26 08:24:58.246046 2016] [wsgi:error] [pid 24768:tid 140371390662400] 6  

[Mon Dec 26 08:24:58.246061 2016] [wsgi:error] [pid 24768:tid 140371390662400] 5  

观察了很久,发现每一行错误日志最后的内容都是项目中打印的字段,网上查了很久,最终发现这些wsgi:error是Django代码中的print语句引起的,注释掉所有的print语句后问题解决。

参考文献:

http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html

http://serverfault.com/questions/239614/wsgi-and-python-print-statements
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐