use of io.sentry.logback.SentryAppender in project FredBoat by Frederikam.
the class SentryConfiguration method getSentryLogbackAppender.
// programmatically creates a sentry appender
private static synchronized SentryAppender getSentryLogbackAppender() {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
ch.qos.logback.classic.Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
SentryAppender sentryAppender = (SentryAppender) root.getAppender(SENTRY_APPENDER_NAME);
if (sentryAppender == null) {
sentryAppender = new SentryAppender();
sentryAppender.setName(SENTRY_APPENDER_NAME);
ThresholdFilter warningsOrAboveFilter = new ThresholdFilter();
warningsOrAboveFilter.setLevel(Level.WARN.levelStr);
warningsOrAboveFilter.start();
sentryAppender.addFilter(warningsOrAboveFilter);
sentryAppender.setContext(loggerContext);
root.addAppender(sentryAppender);
}
return sentryAppender;
}
use of io.sentry.logback.SentryAppender in project Backend by FredBoat.
the class SentryConfiguration method getSentryLogbackAppender.
// programmatically creates a sentry appender if it doesn't exist yet
private static synchronized SentryAppender getSentryLogbackAppender() {
LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
ch.qos.logback.classic.Logger root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);
SentryAppender sentryAppender = (SentryAppender) root.getAppender(SENTRY_APPENDER_NAME);
if (sentryAppender == null) {
sentryAppender = new SentryAppender();
sentryAppender.setName(SENTRY_APPENDER_NAME);
ThresholdFilter warningsOrAboveFilter = new ThresholdFilter();
warningsOrAboveFilter.setLevel(Level.WARN.levelStr);
warningsOrAboveFilter.start();
sentryAppender.addFilter(warningsOrAboveFilter);
sentryAppender.setContext(loggerContext);
root.addAppender(sentryAppender);
}
return sentryAppender;
}
Aggregations