From d80c4fa7f8715205cb2f6c3f45913ef973b71bef Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 5 Feb 2026 10:27:12 +0100 Subject: [PATCH 1/2] Silence WARN from logging integrations/sdks when DSN is not configured --- .../src/main/java/io/sentry/log4j2/SentryAppender.java | 5 ++++- .../src/main/java/io/sentry/logback/SentryAppender.java | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java b/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java index 70a0ae48e23..6885cdb81fd 100644 --- a/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java +++ b/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java @@ -184,7 +184,10 @@ public void start() { Optional.ofNullable(transportFactory).ifPresent(options::setTransportFactory); }); } catch (IllegalArgumentException e) { - LOGGER.warn("Failed to init Sentry during appender initialization: " + e.getMessage()); + final @Nullable String errorMessage = e.getMessage(); + if (errorMessage == null || !errorMessage.startsWith("DSN is required.")) { + LOGGER.warn("Failed to init Sentry during appender initialization: " + errorMessage); + } } addPackageAndIntegrationInfo(); super.start(); diff --git a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java index 7e8edaca89d..20fdf304bda 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -71,7 +71,10 @@ public void start() { try { Sentry.init(options); } catch (IllegalArgumentException e) { - addWarn("Failed to init Sentry during appender initialization: " + e.getMessage()); + final @Nullable String errorMessage = e.getMessage(); + if (errorMessage == null || !errorMessage.startsWith("DSN is required.")) { + addWarn("Failed to init Sentry during appender initialization: " + errorMessage); + } } } else if (!Sentry.isEnabled()) { options From 59a2747d171c4151f6ea636a4f340f79c7620d31 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 12 Feb 2026 14:12:41 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94420404789..e1573c79a1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ - When merging tombstones with Native SDK, use the tombstone message if the Native SDK didn't explicitly provide one. ([#5095](https://github.com/getsentry/sentry-java/pull/5095)) - Fix thread leak caused by eager creation of `SentryExecutorService` in `SentryOptions` ([#5093](https://github.com/getsentry/sentry-java/pull/5093)) - There were cases where we created options that ended up unused but we failed to clean those up. +- No longer log a warning if a logging integration cannot initialize Sentry due to missing DSN ([#5075](https://github.com/getsentry/sentry-java/pull/5075)) + - While this may have been useful to some, it caused lots of confusion. ### Dependencies