【发布时间】:2019-02-05 03:49:36
【问题描述】:
我正在使用以下版本的 Python、Django 和 Gunicorn 使用 Digitalocean 一键式 Django 服务器部署。
gunicorn (version 19.7.1)
python 2.7
我似乎不知道如何将访问日志记录到文件中。下面是我的 gunicorn.service 文件。
[Unit]
Description=Gunicorn daemon for Django Project
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/egre
ExecStart=/usr/bin/gunicorn --name=egre --pythonpath=/home/django/egre --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py --access-logfile /var/log/emperor.log eGRE.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
https://docs.gunicorn.org/en/19.7.1/settings.html#logging
遵循上述文档后,我尝试使用--access-logfile=-,它可以工作,但在传递相对路径后不会将我的标准输出记录到文件中,gunicorn 不会重新启动并给出退出代码 1。
如何将日志写入emerge.log?
【问题讨论】:
标签: django gunicorn digital-ocean