我希望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"
答案 0 :(得分:1)
解决方案是使用req-logger而不是logto(它将捕获应用程序中的所有记录器)。 除了使您的日志格式为apache样式外,请使用下面的log-format值。
[uwsgi]
req-logger = file:/some_base_path/logs/access.log
log-format = %(addr) - %(user) [%(ltime)] "%(method) %(uri) %(proto)" %(status) %(size) "%(referer)" "%(uagent)"