sentry与maven-logback集成

1.pom文件中加下面这段依赖
<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-logback</artifactId>
    <version>1.7.5</version>
</dependency>
2.找到放到项目中
sentry-1.7.5.jar
sentry-logback-1.7.5.jar
3.logback.xml配置
<!– Configure the Sentry appender, overriding the logging threshold to the WARN level –>
<appender name=”Sentry” class=”io.sentry.logback.SentryAppender”>
    <filter class=”ch.qos.logback.classic.filter.ThresholdFilter”>
        <level>ERROR</level>
    </filter>
</appender>
<!– Enable the Console and Sentry appenders, Console is provided as an example
of a non-Sentry logger that is set to a different logging threshold –>
<root level=”INFO”>
    <appender-ref ref=”Console” />
    <appender-ref ref=”Sentry” />
</root>

sentry与maven-log4j2集成

1.pom文件中加下面这段依赖  (开发用)
<dependency>
    <groupId>io.sentry</groupId>
    <artifactId>sentry-log4j2</artifactId>
    <version>1.7.5</version>
</dependency>
===============================================
2.找到放到项目(WEB-INF/lib)
sentry-1.7.5.jar
sentry-log4j2-1.7.5.jar
3. 修改log4j2.xml配置(WEB-INF/classes)
configuration节点上  新增packages=”org.apache.logging.log4j.core,io.sentry.log4j2″
configuration–appenders节点中 <Sentry name=”Sentry” />
configuration–loggers–root节点中 <appender-ref ref=”Sentry” level=”ERROR” />
注意:按实际修改文件,下面只是例子
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration status=”warn” packages=”org.apache.logging.log4j.core,io.sentry.log4j2″><!– 修改行 新增packages=”org.apache.logging.log4j.core,io.sentry.log4j2″ –>
    <appenders>
        <Console name=”Console” target=”SYSTEM_OUT”>
            <PatternLayout pattern=”%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} – %msg%n” />
        </Console>
        <Sentry name=”Sentry” /><!– 新增行 –>
    </appenders>
    <loggers>
        <root level=”INFO”>
            <appender-ref ref=”Console” />
            <appender-ref ref=”Sentry” level=”ERROR” /><!– 新增行 –>
        </root>
    </loggers>
</configuration>
4.把sentry.properties放到WEB-INF/classes下
按实际修改下面这三个参数
dsn=http://7611ceb987d2493385c0d6cd301cbbc5:3e23589304564d148414659401d8e52c@192.168.8.54:9000/admin/2
servername=192.168.10.207
buffer.dir=/usr/local/tomcat/logs/sentry-events