5

我正在尝试使用 gunicorn + supervisor 运行一个小型 WSGI 应用程序,尽管一切正常,但我无法将日志记录到文件中。

如果我直接运行 gunicorn 命令,它确实可以工作,将所有输出发送到我指定的文件,但是一旦我用主管尝试同样的事情,它就不会。

我最近将这个小型 WSGI 应用程序从 uwsgi 移到 gunicorn,并且我没有将 uwsgi 记录到文件的问题,所以我怀疑我在与主管合作时缺少 gunicorn 需要的东西,或者存在不明显的问题我。

该应用程序被调用upload,这是该应用程序的主管配置的样子:

[program:upload]
command=/vagrant/venv/bin/gunicorn -w 4 upload.wsgi:application --log-file /vagrant/log/application.log --log-level debug
directory=/vagrant
autostart=true
autorestart=true

该文件/vagrant/log/application.log永远不会得到任何输入。如果我command直接运行上面的代码,它会使用有关启动工人的正常 gunicorn 信息:

2013-08-20 14:01:24 [1898] [INFO] Starting gunicorn 17.5
2013-08-20 14:01:24 [1898] [DEBUG] Arbiter booted
2013-08-20 14:01:24 [1898] [INFO] Listening at: http://127.0.0.1:8000 (1898)
2013-08-20 14:01:25 [1898] [INFO] Using worker: sync
2013-08-20 14:01:25 [1903] [INFO] Booting worker with pid: 1903
...

我也尝试redirect_stderr在主管配置中使用,但这也确实使日志文件能够获取任何信息。

这是一个已知问题吗?还是我需要其他标志?(注意应用程序正在使用gevent,不确定是否与此问题有关)

4

0 回答 0