【发布时间】:2017-01-05 01:27:45
【问题描述】:
我的配置文件
[loggers]
keys=root, gunicorn.error, gunicorn.access
[handlers]
keys=console, error_file, access_file
[formatters]
keys=generic, access
[logger_root]
level=INFO
handlers=console
[logger_gunicorn.error]
level=INFO
handlers=error_file
propagate=1
qualname=gunicorn.error
[logger_gunicorn.access]
level=INFO
handlers=access_file
propagate=0
qualname=gunicorn.access
[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_error_file]
class=logging.FileHandler
formatter=generic
args=('/tmp/gunicorn.error.log',)
[handler_access_file]
class=logging.FileHandler
formatter=access
args=('/tmp/gunicorn.access.log',)
[formatter_generic]
format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s
datefmt=%Y-%m-%d %H:%M:%S
class=logging.Formatter
[formatter_access]
format=%(message)s
class=logging.Formatter
我要执行的命令
gunicorn --env DJANGO_SETTINGS_MODULE=myproject.settings myproject.wsgi --log-level debug --log-file=- -c file:gunicorn_log.conf
收到此错误
Failed to read config file: gunicorn_log.conf
Traceback (most recent call last):
File "/home/jameel/django-env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 93, in get_config_from_filename
execfile_(filename, cfg, cfg)
File "/home/jameel/django-env/local/lib/python2.7/site-packages/gunicorn/_compat.py", line 91, in execfile_
return execfile(fname, *args)
File "gunicorn_log.conf", line 27
class=StreamHandler
^
SyntaxError: invalid syntax
按照他们在 github link 中的示例跟踪我
【问题讨论】:
-
这是记录器配置文件,不是 gunicorn
标签: python django logging celery gunicorn