我已经在Django 1.4上使用以下日志配置配置了Raven 2.0.2:
'handlers': {
...
'sentry': {
'level':'INFO',
'class': 'raven.contrib.django.handlers.SentryHandler',
},
},
'loggers': {
'' : {
'level': 'INFO',
'handlers': ['sentry'],
},
'django' : {
'handlers': ['console-error', 'sentry'],
'propagate': False,
'level': 'DEBUG'
},
'django.request': {
'handlers': [],
'level': 'ERROR',
'propagate': True,
},
}
Logging for "django" logger工作良好。对于根级记录器,如果我尝试记录一条ERROR级别的消息,它就会通过。但是,当我尝试记录INFO级别的消息时,我得到以下错误:
Top level Sentry exception caught - failed creating log record
Configuring Raven for host: http://1e437dc0d8e347f2b655246d25aa3544:59b1969faf0b4f2e85a823fba93d058a@dev.project.com:9000:/3
Traceback (most recent call last):
File "/home/dev/env/project/lib/python2.6/site-packages/raven/handlers/logging.py", line 59, in emit
return self._emit(record)
File "/home/dev/env/project/lib/python2.6/site-packages/raven/contrib/django/handlers.py", line 32, in _emit
return super(SentryHandler, self)._emit(record, request=request)
File "/home/dev/env/project/lib/python2.6/site-packages/raven/handlers/logging.py", line 126, in _emit
return self.client.capture('Message', message=record.msg, params=record.args,
File "/home/dev/env/project/lib/python2.6/site-packages/raven/contrib/django/models.py", line 49, in <lambda>
__getattr__ = lambda x, o: getattr(get_client(), o)
File "/home/dev/env/project/lib/python2.6/site-packages/raven/contrib/django/models.py", line 133, in get_client
instance = getattr(__import__(module, {}, {}, class_name), class_name)(**options)
File "/home/dev/env/project/lib/python2.6/site-packages/raven/base.py", line 152, in __init__
self.logger.info(msg)
File "/usr/lib/python2.6/logging/__init__.py", line 1056, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python2.6/logging/__init__.py", line 1172, in _log
record = self.makeRecord(self.name, level, fn, lno, msg, args, exc_info, func, extra)
File "/usr/lib/python2.6/logging/__init__.py", line 1147, in makeRecord
rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
File "/usr/lib/python2.6/logging/__init__.py", line 252, in __init__
self.levelname = getLevelName(level)
RuntimeError: maximum recursion depth exceeded
我做错了什么?
当我有一个新版本的raven指向一个旧版本的sentry时,我遇到了这个问题。
确保你的乌鸦是你正在运行的哨兵实例的正确乌鸦