Gunicorn-没有访问日志

Cre*_*ter 2 python logging gunicorn sanic

目前,我正在使用ganicorn作为守护程序运行sanic(microframework)web服务,我想将所有日志保存在文件中(访问和错误)

我的配置:

reload = True
daemon = True
bind = '0.0.0.0:6666'
worker_class = 'sanic.worker.GunicornWorker'
loglevel = 'debug'
accesslog = 'access.log'
access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
errorlog = 'error.log'
Run Code Online (Sandbox Code Playgroud)

接下来,我启动网络服务:

gunicorn --config config.py app:app
Run Code Online (Sandbox Code Playgroud)

如此..我的错误日志有效,但我绝对没有访问日志..

文档中没有有关此问题的提示,有人可以帮助我吗?

谢谢和问候!

mat*_*LVW 6

你可以尝试:

gunicorn --config config.py app:app --access-logfile '-'
Run Code Online (Sandbox Code Playgroud)

并查看是否在stdout(控制台输出)上记录了任何内容?

  • @srikarkulkarni,这是因为您通过gunicorn配置覆盖了cmd开关`--access-logfile`。尝试删除“accesslog”或将其更改为“accesslog = '-'”。https://docs.gunicorn.org/en/latest/settings.html#logging (2认同)