diff --git a/pom.xml b/pom.xml
index 73f32c3..f229ffa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,9 +108,9 @@
0.6
- com.getsentry.raven
- raven-logback
- 7.8.2
+ io.sentry
+ sentry-logback
+ 6.11.0
diff --git a/src/main/java/com/spotify/logging/LoggingConfigurator.java b/src/main/java/com/spotify/logging/LoggingConfigurator.java
index f6469bf..343e283 100644
--- a/src/main/java/com/spotify/logging/LoggingConfigurator.java
+++ b/src/main/java/com/spotify/logging/LoggingConfigurator.java
@@ -50,9 +50,10 @@
import ch.qos.logback.core.CoreConstants;
import ch.qos.logback.core.joran.spi.JoranException;
import ch.qos.logback.core.util.StatusPrinter;
-import com.getsentry.raven.logback.SentryAppender;
import com.spotify.logging.logback.CustomLogstashEncoder;
import com.spotify.logging.logback.MillisecondPrecisionSyslogAppender;
+import io.sentry.SentryOptions;
+import io.sentry.logback.SentryAppender;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.nio.charset.StandardCharsets;
@@ -341,7 +342,9 @@ public static SentryAppender addSentryAppender(final String dsn, Level logLevelT
final LoggerContext context = rootLogger.getLoggerContext();
SentryAppender appender = new SentryAppender();
- appender.setDsn(dsn);
+ SentryOptions sentryOptions = new SentryOptions();
+ sentryOptions.setDsn(dsn);
+ appender.setOptions(sentryOptions);
appender.setContext(context);
ThresholdFilter levelFilter = new ThresholdFilter();
diff --git a/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java b/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java
index 17a77ad..3674f25 100644
--- a/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java
+++ b/src/test/java/com/spotify/logging/LoggingConfiguratorTest.java
@@ -36,6 +36,7 @@
package com.spotify.logging;
+import static com.spotify.logging.LoggingConfigurator.addSentryAppender;
import static com.spotify.logging.LoggingConfigurator.getSyslogAppender;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -47,8 +48,10 @@
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.net.SyslogAppender;
import ch.qos.logback.core.ConsoleAppender;
+import ch.qos.logback.core.status.Status;
import com.google.common.collect.FluentIterable;
import com.spotify.logging.logback.CustomLogstashEncoder;
+import io.sentry.logback.SentryAppender;
import net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider;
import org.junit.Rule;
import org.junit.Test;
@@ -107,6 +110,31 @@ public void testGetSyslogAppenderRespectsNewLineReplacement() {
appender.getSuffixPattern());
}
+ @Test
+ public void testGetSentryAppenderNoErrorsWithDsnOption() {
+ SentryAppender sentryAppender =
+ addSentryAppender(
+ "https://examplePublicKey@o0.ingest.sentry.io/0", LoggingConfigurator.Level.ERROR);
+
+ assertEquals(
+ 0,
+ sentryAppender.getContext().getStatusManager().getCopyOfStatusList().stream()
+ .filter(
+ status -> {
+ if (status.getLevel() == Status.WARN
+ && status
+ .getMessage()
+ .contains(
+ "Failed to init Sentry during appender initialization: DSN is "
+ + "required. Use empty string to disable SDK.")) {
+ return true;
+ }
+
+ return false;
+ })
+ .count());
+ }
+
private String getLoggingContextHostnameProperty() {
final Logger accessPointLogger = (Logger) LoggerFactory.getLogger("logger");
final LoggerContext loggerContext = accessPointLogger.getLoggerContext();