簡體   English   中英

強制uwsgi僅寫入日志文件請求

[英]Force uwsgi to write to log file only requests

我希望uwsgi服務器僅記錄請求,跳過所有與uwsgi啟動相關的條目,等等。以下是從日志文件中提取內容的示例。 是否有我缺少的設置?

*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x193c890
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145520 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 6 seconds on interpreter 0x193c890 pid: 23761 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 23761)
spawned uWSGI worker 1 (pid: 23763, cores: 1)
192.168.33.1 - - [07/Apr/2015:22:02:17 +0000] "GET / HTTP/1.1" 200 4611 "http://192.168.33.10/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"
192.168.33.1 - - [07/Apr/2015:22:02:17 +0000] "GET /static/bower_components/bootstrap-multiselect/dist/css/bootstrap-multiselect.css HTTP/1.1" 304 303 "http://192.168.33.10/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"
192.168.33.1 - - [07/Apr/2015:22:02:17 +0000] "GET /static/bower_components/bootstrap/dist/css/bootstrap.css HTTP/1.1" 304 305 "http://192.168.33.10/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"
192.168.33.1 - - [07/Apr/2015:22:02:17 +0000] "GET /static/css/bootstrap.css HTTP/1.1" 304 305 "http://192.168.33.10/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"
192.168.33.1 - - [07/Apr/2015:22:02:17 +0000] "GET /static/css/style.css HTTP/1.1" 304 303 "http://192.168.33.10/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36"

解決方案是使用req-logger而不是logto(這將捕獲應用程序中的所有記錄器)。 除了使您的日志格式為Apache樣式外,請使用以下日志格式值。

[uwsgi]
req-logger = file:/some_base_path/logs/access.log
log-format = %(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM