2016-03-11 46 views
0

我想在這張照片禁用日誌記錄(紅色框):如何在啓動turbogear2時禁用日誌記錄?

enter image description here

我用TurboGears的2.3.7。當我啓動變速箱服務器並訪問我的網址http://localhost:8778。在日誌中將顯示訪問網址。

例如:

127.0.0.1 - - [11/Mar/2016 16:59:06] "GET /css/bootstrap.min.css HTTP/1.1" 304 0 
127.0.0.1 - - [11/Mar/2016 16:59:06] "GET /css/style.css HTTP/1.1" 304 0 
127.0.0.1 - - [11/Mar/2016 16:59:06] "GET /css/style.css HTTP/1.1" 304 0 
127.0.0.1 - - [11/Mar/2016 16:59:06] "GET /css/style.css HTTP/1.1" 304 0 

回答

4

這是由您與wsgiref服務器服務的應用程序造成的事實。您可以看到,您在development.ini文件的[server:main]部分內有use = egg:gearbox#wsgiref

僅用於開發的wsgiref服務器沒有正確的日誌記錄配置,只是將所有內容輸出到stderr

如果你想管理日誌記錄,你可以切換到更適合的服務器,如女服務員

pip install waitress,然後在development.ini放像:

[server:main] 
use = egg:waitress#main 

代替

[server:main] 
use = egg:gearbox#wsgiref