【问题标题】:How to custom gunicorn logger formatter?如何自定义 gunicorn 记录器格式化程序?
【发布时间】:2017-03-23 05:07:00
【问题描述】:

我使用 gunicorn + nginx + supervisor +django 。我得到了这个日志:

[2016-11-09 19:27:53 +0000] [14676] [DEBUG] GET /audit/list_pay/

这是我的启动 gunicorn cmd:

gunicorn myproject.wsgi:application --workers 4 --bind 0.0.0.0:8001 --log-level debug --log-file=-

我的主管配置:

[program:cmdb]
command= /usr/local/cmdb/cmdb_gunicorn_start
directory=/usr/local/cmdb
startsecs=0
stopwaitsecs=10
autostart=false
autorestart=false
stdout_logfile=/data/logs/cmdb_gunicorn.log
redirect_stderr=true

我把--access-logformat "%(h)s %(l)s %(u)s %(t)s %(s)s %(b)s"附加了gunicorn start cmd,但它不起作用。

我尝试了另一个 gunicorn 日志参数,但它们不起作用。我不知道可以使用哪些记录器参数。

我应该怎么做才能获得更多记录器信息。

【问题讨论】:

    标签: django logging gunicorn supervisord formatter


    【解决方案1】:

    根据Nginx docs,您需要用另一个百分比来转义每个百分比。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-29
      • 2017-11-09
      • 2017-08-03
      • 1970-01-01
      • 2017-03-24
      • 2012-07-19
      • 1970-01-01
      相关资源
      最近更新 更多