如何获取访问日志

新手上路,请多包涵

目前我正在使用 gunicorn 作为守护进程运行我的 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'

接下来我启动网络服务:

 gunicorn --config config.py app:app

所以,我的错误日志有效,但我绝对没有访问日志。

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

原文由 Creative crypter 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 347
1 个回答

你能试试吗:

 gunicorn --config config.py app:app --access-logfile '-'

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

原文由 matt.LLVW 发布,翻译遵循 CC BY-SA 3.0 许可协议

推荐问题