uwsgi 启动失败但不记录任何错误

uwsgi start fails but does not log any error

我已经在 ubuntu 12.04.

上设置了一个 uwsgi 服务

这是我正在使用的自定义配置文件:

[uwsgi]
# this is the path to the virtualenv
home = /var/www/api/webservice/current/

# this will point to the same file
paste = config:/var/www/api/webservice/production.ini

socket = /tmp/my_api.socket
gid = www-data
uid = www-data
logdate = true
master = true
harakiri = 30
limit-as = 1536
reload-on-as = 1200
no-orphans = true
log-x-forwarded-for = true
threads = 15
workers = 2
stats = /tmp/my_api_stats.socket
listen = 400

当我 运行 sudo service uwsgi start 我得到 "Fail"。 但是 /var/log/uwsgi/app/my_api.log 中的日志没有显示任何错误消息。

我该如何调试它?

也许uwsgi --ini this_config_file.ini会帮你调试一下?

作为调试步骤,您可以检查 uwsgi 服务的 /etc/systemd/system 单元配置中的 ExecStart 命令。尝试 运行 该命令,看看是否有关于该错误的更多信息。

顺便问一下,您确定您的日志文件 /var/log/uwsgi/app/my_api.log 是写入日志的那个文件吗?当然,这可能是默认的,但如果不是,你应该在你的配置中有 logto=/path/to/the/log 选项。

如果您使用的是基于 debian 的 linux os,默认情况下您会在 /var/log/uwsgi/app/log.

中找到您应用程序的日志

在调试uwsgi服务启动失败的原因时,我也犯了难。 对我来说 uwsgi --ini this_config_file.ini 工作正常,但 service uwsgi start 没有提供太多信息就失败了。