将Django请求日志保存到文件中 [英] Save django request logs in a file

查看:576
本文介绍了将Django请求日志保存到文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Django在命令行中显示了请求日志,我想将该日志保存到文件中.我在这里找到了解决方案,但是它仅保存我们手动打印的日志.我们可以将所有请求和响应日志保存在单独的文件中吗?

Django shows the requests logs in command line, I want to save that logs in a file. I found a solution here but it saves the logs only that we print manually. Can we save all of the request and response logs in a separate file?

推荐答案

我希望在Linux和Windows上都可以使用它

This should work on both linux and windows I hope:

python manage.py runserver > logs.txt

这篇关于将Django请求日志保存到文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆