启用--access-logfile的gunicorn引发“ TypeError:格式需要映射”

时间:2018-07-10 22:37:25

标签: flask gunicorn

我正在python 2.6,gunicorn 19.9.0上运行flask应用程序。启用access-logfile时,出现记录错误。以下是完整的执行/堆栈跟踪。我真的很想拥有我的访问日志:(。

/usr/bin/gunicorn --log-level=debug --access-logfile=- --error-logfile=- -w 4 -b 0.0.0.0:8000 api:application
[2018-07-10 22:23:56 +0000] [32082] [DEBUG] Current configuration:
  ...
  accesslog: -
  disable_redirect_access_to_syslog: False
  statsd_host: None
  ...
  errorlog: -
  enable_stdio_inheritance: False
  worker_class: sync
  ...
  logconfig: None
  logconfig_dict: {}
  config: None
  access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
  ....
  loglevel: debug
  syslog_addr: udp://localhost:514
  syslog: False
  syslog_prefix: None
  .....
  logger_class: gunicorn.glogging.Logger
[2018-07-10 22:23:56 +0000] [32082] [INFO] Starting gunicorn 19.9.0
[2018-07-10 22:23:56 +0000] [32082] [DEBUG] Arbiter booted
[2018-07-10 22:23:56 +0000] [32082] [INFO] Listening at: http://0.0.0.0:8000 (32082)
[2018-07-10 22:23:56 +0000] [32082] [INFO] Using worker: sync
[2018-07-10 22:23:56 +0000] [32087] [INFO] Booting worker with pid: 32087
[2018-07-10 22:23:56 +0000] [32092] [INFO] Booting worker with pid: 32092
[2018-07-10 22:23:56 +0000] [32097] [INFO] Booting worker with pid: 32097
[2018-07-10 22:23:56 +0000] [32102] [INFO] Booting worker with pid: 32102
[2018-07-10 22:23:56 +0000] [32082] [DEBUG] 4 workers
[2018-07-10 22:24:02 +0000] [32092] [DEBUG] GET /
Traceback (most recent call last):
  File "/usr/lib64/python2.6/logging/__init__.py", line 784, in emit
    msg = self.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 662, in format
    return fmt.format(record)
  File "/usr/lib64/python2.6/logging/__init__.py", line 444, in format
    record.message = record.getMessage()
  File "/usr/lib64/python2.6/logging/__init__.py", line 314, in getMessage
    msg = msg % self.args
TypeError: format requires a mapping
[2018-07-10 22:24:13 +0000] [32087] [DEBUG] Closing connection.

0 个答案:

没有答案
相关问题