How to enable uWSGI logging to a file?

夙愿已清 提交于 2019-12-18 19:05:20

问题


I have just installed my first uWSGI server on EC2 Ubuntu 14.04 LTS, using the following configuration:

[uwsgi]
http-socket    = :9001
plugin    = python
wsgi-file = foo.wsgi
chdir = /home/bar
process   = 3

The uWSGI container works fine, but has no logging. Following the manual, I've added the following:

logger = file:/tmp/errlog

But restarting (using sudo service uwsgi restart) did not work - the server would not start with this configuration.

Any idea what's missing from my ini configuration?


回答1:


The "common" syntax is "logto = file".

The logger option is used for advanced plugins, if you want to use the 'file' one you have to load the logfile plugin (like you load the python one). But honestly if you only want to log to a file, logto will be more than enough




回答2:


The accepted answer did not work for me (possibly because it is 4 years old). Nginx running uwsgi 2.0.17.1 in a virtual env with circus controlling the workers. This did work though:

req-logger = file:/var/log/uwsgi/app/cart-req.log
logger = file:/var/log/uwsgi/app/cart-err.log

Not sure if it was necessary, but I

$ chmod -R www-data:www-data /var/log/uwsgi/app

ref: https://uwsgi-docs.readthedocs.io/en/latest/Logging.html

as uwsgi runs as www-data



来源:https://stackoverflow.com/questions/23982411/how-to-enable-uwsgi-logging-to-a-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!