阅读实时控制台的内容

时间:2016-02-27 14:54:31

标签: python django windows console

我想知道是否可以直接阅读Windows控制台中发生的事情,并将其存储在日志/文本文件中,或者在运行时存储为某种字符串。

以下是显示的一些信息的示例。在这种情况下,它说明了它正在运行的django / python网页上发生了什么:

[27/Feb/2016 14:51:50] "GET /color_liker/static/color_ajax_switch.js HTTP/1.1" 404 1697
[27/Feb/2016 14:51:52] "GET /color_liker/search/?color_search_text=th HTTP/1.1" 200 93
[27/Feb/2016 14:51:53] "GET /color_liker/search/?color_search_text=thi HTTP/1.1" 200 94
[27/Feb/2016 14:51:53] "GET /color_liker/search/?color_search_text=this HTTP/1.1" 200 95
[27/Feb/2016 14:51:54] "GET /color_liker/search/?color_search_text=this HTTP/1.1" 200 95
[27/Feb/2016 14:51:54] "GET /color_liker/search/?color_search_text=this+i HTTP/1.1" 200 97
[27/Feb/2016 14:51:55] "GET /color_liker/search/?color_search_text=this+is HTTP/1.1" 200 98
[27/Feb/2016 14:51:55] "GET /color_liker/search/?color_search_text=this+is HTTP/1.1" 200 98
[27/Feb/2016 14:51:55] "GET /color_liker/search/?color_search_text=this+is+a HTTP/1.1" 200 100
[27/Feb/2016 14:51:56] "GET /color_liker/search/?color_search_text=this+is+a HTTP/1.1" 200 100
[27/Feb/2016 14:51:56] "GET /color_liker/search/?color_search_text=this+is+a+t HTTP/1.1" 200 102
[27/Feb/2016 14:51:57] "GET /color_liker/search/?color_search_text=this+is+a+te HTTP/1.1" 200 103
[27/Feb/2016 14:51:57] "GET /color_liker/search/?color_search_text=this+is+a+tes HTTP/1.1" 200 104
[27/Feb/2016 14:51:58] "GET /color_liker/like_color_3/ HTTP/1.1" 200 46
[27/Feb/2016 14:51:59] "GET /color_liker/like_color_6/ HTTP/1.1" 200 45
[27/Feb/2016 14:52:00] "GET /color_liker/like_color_1/ HTTP/1.1" 200 45
[27/Feb/2016 14:52:01] "GET /color_liker/like_color_2/ HTTP/1.1" 200 45
[27/Feb/2016 14:52:03] "GET /color_liker/search/?color_search_text=this+is+a+test HTTP/1.1" 200 105

基本上,一旦能够阅读文件,我理想情况下能够解析我实际需要的信息,但我不确定如何进入该阶段。< / p>

0 个答案:

没有答案