我正在使用python 2.5.2和django 1.3.2 我的设置是使用这种日志格式,它是正确的吗?
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
},
'handlers': {
'mail_admins': {
'level': 'ERROR',
'class': 'log.CommonAdminEmailHandler'
}
},
'loggers': {
'django.request': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True,
},
}
}
并返回此错误:
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 250, in __call__
self.load_middleware()
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 39, in load_middleware
for middleware_path in settings.MIDDLEWARE_CLASSES:
File "/usr/lib/python2.5/site-packages/django/utils/functional.py", line 276, in __getattr__
self._setup()
File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/usr/lib/python2.5/site-packages/django/conf/__init__.py", line 139, in __init__
logging_config_func(self.LOGGING)
File "/usr/lib/python2.5/site-packages/django/utils/dictconfig.py", line 553, in dictConfig
dictConfigClass(config).configure()
File "/usr/lib/python2.5/site-packages/django/utils/dictconfig.py", line 352, in configure
'%r: %s' % (name, e))
ValueError: Unable to configure handler 'mail_admins': super() argument 1 must be type, not classobj
当我删除Logging块时,它的启动就可以了。 有什么想法吗?
答案 0 :(得分:0)
尝试用 -
替换'class'的值django.utils.log.AdminEmailHandler
了解更多信息 - https://docs.djangoproject.com/en/dev/topics/logging/#configuring-logging