美文网首页
Sentry的安装和使用

Sentry的安装和使用

作者: 樊海鹏 | 来源:发表于2018-04-08 14:47 被阅读0次

    安装

    建议使用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

    相关文章

      网友评论

          本文标题:Sentry的安装和使用

          本文链接:https://www.haomeiwen.com/subject/bkaphftx.html