logback輸出日誌到sentry

maven

<dependency>
            <groupId>com.getsentry.raven</groupId>
            <artifactId>raven-logback</artifactId>
            <version>8.0.3</version>
        </dependency>

配置logback.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml"/>
    <jmxConfigurator/>

    <appender name="SENTRY" class="com.getsentry.raven.logback.SentryAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>ERROR</level>
        </filter>
    </appender>

    <root level="INFO">
        <appender-ref ref="CONSOLE" />
        <appender-ref ref="FILE" />
        <appender-ref ref="SENTRY" />
    </root>
</configuration>

配置環境變量

SENTRY_ENVIRONMENT=test
SENTRY_DSN=http://1d59201178e540ec8172870df4413aa2:20131e8bb98c4ab48693e4f9cd6ef98a@192.168.99.100:9000/2

想獲取最新內容,請關注微信公衆號
圖片描述spring

相關文章
相關標籤/搜索