Tim*_*ony 8 python django logging sentry raven
现在它django-sentry已经成为一个独立的服务器(并且很棒)我正在尝试移植我的应用程序以使用它.
我已经设置了一个独立的服务器,配置了一个django应用程序,根据乌鸦文档使用django 1.3的日志字典conf进行记录.我似乎无法获得任何芹菜任务登录到哨兵服务器(虽然他们确实打印到控制台).
我不确定我应该做什么?我已经加入raven.contrib.django.celery了我的`INSTALLED_APPS'.
正在通过以下方式将未捕获的异常发送到哨兵:自定义日志消息:
import logging
logger = logging.getLogger(__name__)
...
logger.info("Logged Message")
Run Code Online (Sandbox Code Playgroud)
die*_*us9 10
你需要添加这个:
'celery': {
'level': 'WARNING',
'handlers': ['sentry'],
'propagate': False,
},
Run Code Online (Sandbox Code Playgroud)
为了您loggers在变量LOGGING中的设置.
就像是:
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'root': {
'level': 'WARNING',
'handlers': ['sentry'],
},
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d % (message)s'
},
},
'handlers': {
'sentry': {
'level': 'DEBUG',
'class': 'raven.contrib.django.handlers.SentryHandler',
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'verbose'
}
},
'loggers': {
'django.db.backends': {
'level': 'ERROR',
'handlers': ['console'],
'propagate': False,
},
'raven': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'sentry.errors': {
'level': 'DEBUG',
'handlers': ['console'],
'propagate': False,
},
'celery': {
'level': 'WARNING',
'handlers': ['sentry'],
'propagate': False,
},
},
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8049 次 |
| 最近记录: |