安装
建议使用Docker安装, 可以参考以下文章
https://laravel-china.org/articles/4285/build-your-own-sentry-service
https://laravel-china.org/articles/9405/the-deployment-of-sentry-into-the-production-environment
http://beginman.cn/sentry/2016/11/04/centos-install-sentry/
http://www.yunweipai.com/archives/22303.html
使用
# -*- coding: utf-8 -*
import logging
from raven.handlers.logging import SentryHandler
from raven.conf import setup_logging
DSN = 'http://*******@127.0.0.1:9000/7'
handler = SentryHandler(DSN)
handler.setLevel(logging.ERROR)
setup_logging(handler)
logger = logging.getLogger(__name__)
try:
1 / 0
except ZeroDivisionError:
logger.error('This is a test message', extra={'stack': True})
sudo python test_sentry.py
网友评论