【问题标题】:Gunicorn log HTTP requests made to itGunicorn 记录对其发出的 HTTP 请求
【发布时间】:2018-08-28 01:54:22
【问题描述】:

我正在使用以下配置运行 gunicorn

$VIRT_ENV/gunicorn -c config.py utrade.wsgi:application \
                          --log-level=debug \
                          --timeout=0 \
                          --access-logfile=-\
                          --log-file=-

但是,如果独立运行,它不会像 Django 那样记录 HTTP 请求 (POST/GET)。像下面的那些

INFO:django.server:"GET / HTTP/1.1" 302 0
INFO:django.server:"GET /login/?next=/ HTTP/1.1" 200 5676

【问题讨论】:

    标签: django logging gunicorn


    【解决方案1】:

    在 'loggers' 块中的 django settings.py 文件的记录器中添加 gunicorn.access。

    LOGGING = {
      # ..
      'loggers': {
         # ..
         'gunicorn.access' : {
             'level': 'DEBUG',
             'handlers': ['console'],
             'propagate':False
         }
       }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-05-13
      • 2014-07-18
      • 1970-01-01
      • 1970-01-01
      • 2013-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多