我正在运行我的Django网站作为UWSGI皇帝的附庸。我创建了/etc/uwsgi-emperor/vassals/mysite.ini
如下:
[uwsgi]
socket = /var/opt/mysite/uwsgi.sock
chmod-socket = 775
chdir = /opt/mysite
master = true
virtualenv = /opt/mysite_virtualenv
env = DJANGO_SETTINGS_MODULE=mysite.settings
module = mysite.wsgi:application
uid = www-data
gid = www-data
processes = 1
threads = 1
plugins = python3,logfile
logger = file:/var/log/uwsgi/app/mysite.log
vacuum = true
但是Django日志没有出现在file:/var/log/uwsgi/app/mysite.log
中。
哪个处理程序类会将日志传递给UWSGI?
答案 0 :(得分:3)
您可以使用logging.StreamHandler
课程。例如,在settings.py
中定义LOGGING,如下所示:
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'handlers': {
'console': {
'level': 'DEBUG',
'filters': None,
'class': 'logging.StreamHandler',
},
},
'loggers': {
'django': {
'handlers': ['console'],
'level': 'DEBUG',
},
},
}