public static SentryAppender addSentryAppender ( final String dsn , Level logLevelThreshold ) { final Logger rootLogger = ( Logger ) LoggerFactory . getLogger ( Logger . ROOT_LOGGER_NAME ) ; final LoggerContext context = rootLogger . getLoggerContext ( ) ; SentryAppender appender = new SentryAppender ( ) ; appender . setDsn ( dsn ) ; appender . setContext ( context ) ; ThresholdFilter levelFilter = new ThresholdFilter ( ) ; levelFilter . setLevel ( logLevelThreshold . logbackLevel . toString ( ) ) ; levelFilter . start ( ) ; appender . addFilter ( levelFilter ) ; appender . start ( ) ; rootLogger . addAppender ( appender ) ; return appender ; }
Add a sentry appender .