您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

python – 来自django runserver的特定日志输出来自何处

5b51 2022/1/14 8:20:41 python 字数 3812 阅读 457 来源 www.jb51.cc/python

我正在学习如何登录python,所以我试图找到源代码中的哪个部分来格式化该行的特定输出:“GET / dashboard / HTTP / 1.1”200 249176?另外,249176是什么意思?我没有问题,这个问题是为了满足我的好奇心.我真的在寻找这个logrecord的格式化程序.我也没有看到它来自哪个loghandler(也许这根本不是来自日志记录

概述

我正在学习如何登录python,所以我试图找到源代码中的哪个部分来格式化该行的特定输出:“GET / dashboard / HTTP / 1.1”200 249176?另外,249176是什么意思?

我没有问题,这个问题是为了满足我的好奇心.

我真的在寻找这个logrecord的格式化程序.我也没有看到它来自哪个loghandler(也许这根本不是来自日志记录模块,它只是一个打印命令).我搜索了源代码,无法找到它的来源,并希望有一个链接到源代码.

以下是我运行代码时会发生的情况.

September 05,2013 - 05:38:50
Django version 1.5.1,using settings 'dapi.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[05/Sep/2013 05:38:57] "GET /dashboard/ HTTP/1.1" 200 249176
[05/Sep/2013 05:38:58] "GET /static/plugins/uniform/css/uniform.default.css HTTP/1.1" 304 0
[05/Sep/2013 05:38:58] "GET /static/plugins/bootstrap-daterangepicker/daterangepicker.css HTTP/1.1" 304 0

这个输出基本上来自wsgirefsimple_server(它基于BaseHTTPServer)django内部使用(source).

log_request()函数实际上记录了引擎盖下的代码内容大小:

log_request([code[,size]])

Logs an accepted (successful) request.
code should specify the numeric HTTP code associated with the
response. If a size of the response is available,then it should be
passed as the size parameter.

如果您有兴趣,请查看BaseHTTPServer pypy实现:https://bitbucket.org/pypy/pypy/src/9d88b4875d6e/lib-python/2.7/BaseHTTPServer.py

也可以看看:

> What’s the meaning of the default output of manage.py runserver?

总结

以上是编程之家为你收集整理的python – 来自django runserver的特定日志输出来自何处全部内容,希望文章能够帮你解决python – 来自django runserver的特定日志输出来自何处所遇到的程序开发问题。


如果您也喜欢它,动动您的小指点个赞吧

除非注明,文章均由 laddyq.com 整理发布,欢迎转载。

转载请注明:
链接:http://laddyq.com
来源:laddyq.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。


联系我
置顶