达芙妮未记录错误

时间:2019-04-02 21:56:56

标签: daphne

我有以下systemd配置

[Service]
WorkingDirectory=/srv/www/project_a/project_a/
Environment=JSON_SETTINGS=/srv/www/project_a/project_a.json
ExecStart=/srv/www/project_a/bin/daphne -b 0.0.0.0 -p 8000 project_a.asgi:channel_layer
Restart=always
KillSignal=SIGTERM
NotifyAccess=all
StandardOut=file:/tmp/daphne-access.log
StandardError=file:/tmp/daphne-error.log

但是daphne-access.log和daphone-error.log文件都为空,我以为daphne的默认注销将输出到stdout?

已尝试:--access-log=/tmp/daphne-access.log适用于访问日志,但不知道django错误发生时从哪里获取。

2 个答案:

答案 0 :(得分:1)

只需将以下内容添加到您的LOGGING['loggers']设置中:

'daphne': {
    'handlers': [
        'console',
    ],
    'level': 'DEBUG'
},

答案 1 :(得分:0)

对于django错误,您需要定义django日志。请参阅文档以获取更多信息。

https://docs.djangoproject.com/en/2.2/topics/logging/