我在ngninx後面運行gunicorn。我想在gunicorn-error.log中記錄錯誤,並將日誌記錄到gunicorn-access.log。無法訪問日誌爲gunicorn工作
我有錯誤日誌工作,但沒有訪問日誌,我做錯了什麼?
這是我gunicorn.conf.py:
bind = '127.0.0.1:8888'
backlog = 2048
workers = 3
errorlog = '/home/my/logs/gunicorn-error.log'
accesslog = '/home/my/logs/gunicorn-access.log'
loglevel = 'debug'
proc_name = 'gunicorn-my'
pidfile = '/var/run/my.pid'
這是運行gunicorn腳本:
#!/bin/bash
set -e
ENV=/home/my/env/bin/activate
GUNICORN=gunicorn_django
SETTINGS_PATH=/home/my/app/app/settings
PROJECT_PATH=/home/my/app
CONFROOT=/home/my/app/conf/gunicorn.conf.py
cd $SETTINGS_PATH
source $ENV
export PYTHONPATH=$PROJECT_PATH
exec $GUNICORN app.settings.staging -c $CONFROOT
它創建兩個gunicorn-error.log中和gunicorn-access.log的,但只有gunicorn-error.log中獲得任何日誌,比如:
2012-11-20 11:49:57 [27817] [INFO] Starting gunicorn 0.14.6
2012-11-20 11:49:57 [27817] [DEBUG] Arbiter booted
2012-11-20 11:49:57 [27817] [INFO] Listening at: http://127.0.0.1:8888 (27817)
2012-11-20 11:49:57 [27817] [INFO] Using worker: sync
2012-11-20 11:49:58 [27825] [INFO] Booting worker with pid: 27825
2012-11-20 11:49:58 [27828] [INFO] Booting worker with pid: 27828
2012-11-20 11:49:58 [27830] [INFO] Booting worker with pid: 27830
我在做什麼錯?任何人都想分享他們的工作gunicorn.conf.py與錯誤日誌和訪問日誌?
謝謝!也許更好的日誌在那裏。 – Mikael
問題在於文件處理程序不能通過多個進程登錄。 – dalore
只要fyi萬一其他人遇到這種情況,爲Formatter指定一個特定的類,關鍵是'「()」'不是「class」,類的關鍵是處理程序。文檔中提到[此處](https://docs.python.org/2/library/logging.config.html#logging-config-dictschema)。 – danny