4

我有以下系统配置

[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 的默认注销是输出到标准输出?

尝试过:--access-log=/tmp/daphne-access.log这适用于访问日志,但不知道在哪里发生 django 错误。

4

2 回答 2

6

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

'daphne': {
    'handlers': [
        'console',
    ],
    'level': 'DEBUG'
},
于 2019-11-28T13:35:30.110 回答
0

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

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

于 2019-10-19T16:05:30.317 回答