Skip to content

Commit 5bf02ee

Browse files
adinauerclaude
andcommitted
ref(log4j2)!: Remove deprecated appender constructor
Remove the constructor superseded by the minimumLevel overload in 8.16.0 at the v9 breaking-change boundary. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6df9201 commit 5bf02ee

4 files changed

Lines changed: 8 additions & 52 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
### Breaking Changes
66

7-
- Add a `logsEnabled` argument to the preferred Log4j2 `SentryAppender` constructor and
8-
`createAppender` factory. Pass `true` to opt in to Sentry Logs capture or `false` to keep it
9-
disabled. ([#5941](https://github.com/getsentry/sentry-java/pull/5941))
7+
- Remove the deprecated Log4j2 `SentryAppender` constructor without `minimumLevel`, and add a
8+
`logsEnabled` argument to the remaining constructor and `createAppender` factory. Pass `true` to
9+
opt in to Sentry Logs capture or `false` to keep it disabled.
10+
([#5941](https://github.com/getsentry/sentry-java/pull/5941))
1011
- Require a `logsEnabled` argument when manually constructing `SentryTimberIntegration` or
1112
`SentryTimberTree`. Replace `SentryTimberIntegration()` with
1213
`SentryTimberIntegration(logsEnabled = false)` in Kotlin or `new SentryTimberIntegration(false)`

‎sentry-log4j2/api/sentry-log4j2.api‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ public final class io/sentry/log4j2/BuildConfig {
55

66
public class io/sentry/log4j2/SentryAppender : org/apache/logging/log4j/core/appender/AbstractAppender {
77
public static final field MECHANISM_TYPE Ljava/lang/String;
8-
public fun <init> (Ljava/lang/String;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Ljava/lang/Boolean;Lio/sentry/ITransportFactory;Lio/sentry/IScopes;[Ljava/lang/String;)V
98
public fun <init> (Ljava/lang/String;Lorg/apache/logging/log4j/core/Filter;Ljava/lang/String;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;Lorg/apache/logging/log4j/Level;ZLjava/lang/Boolean;Lio/sentry/ITransportFactory;Lio/sentry/IScopes;[Ljava/lang/String;)V
109
public fun append (Lorg/apache/logging/log4j/core/LogEvent;)V
1110
protected fun captureLog (Lorg/apache/logging/log4j/core/LogEvent;)V

‎sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -65,37 +65,6 @@ public class SentryAppender extends AbstractAppender {
6565
.addPackage("maven:io.sentry:sentry-log4j2", BuildConfig.VERSION_NAME);
6666
}
6767

68-
/**
69-
* @deprecated This constructor is deprecated. Please use {@link #SentryAppender(String, Filter,
70-
* String, Level, Level, Level, boolean, Boolean, ITransportFactory, IScopes, String[])}
71-
* instead.
72-
*/
73-
@Deprecated
74-
@SuppressWarnings("InlineMeSuggester")
75-
public SentryAppender(
76-
final @NotNull String name,
77-
final @Nullable Filter filter,
78-
final @Nullable String dsn,
79-
final @Nullable Level minimumBreadcrumbLevel,
80-
final @Nullable Level minimumEventLevel,
81-
final @Nullable Boolean debug,
82-
final @Nullable ITransportFactory transportFactory,
83-
final @NotNull IScopes scopes,
84-
final @Nullable String[] contextTags) {
85-
this(
86-
name,
87-
filter,
88-
dsn,
89-
minimumBreadcrumbLevel,
90-
minimumEventLevel,
91-
null,
92-
false,
93-
debug,
94-
transportFactory,
95-
scopes,
96-
contextTags);
97-
}
98-
9968
public SentryAppender(
10069
final @NotNull String name,
10170
final @Nullable Filter filter,

‎sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt‎

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -310,26 +310,14 @@ class SentryAppenderTest {
310310
}
311311

312312
@Test
313-
fun `constructors can opt out of logs capture`() {
313+
fun `constructor can opt out of logs capture`() {
314314
val scopes = mock<IScopes>()
315315
val event = mock<LogEvent>()
316316
whenever(event.level).thenReturn(Level.INFO)
317317

318-
val deprecatedAppender =
319-
SentryAppender(
320-
"deprecated",
321-
null,
322-
null,
323-
Level.OFF,
324-
Level.OFF,
325-
null,
326-
null,
327-
scopes,
328-
null,
329-
)
330-
val existingAppender =
318+
val appender =
331319
SentryAppender(
332-
"existing",
320+
"sentry",
333321
null,
334322
null,
335323
Level.OFF,
@@ -342,8 +330,7 @@ class SentryAppenderTest {
342330
null,
343331
)
344332

345-
deprecatedAppender.append(event)
346-
existingAppender.append(event)
333+
appender.append(event)
347334

348335
verify(scopes, never()).logger()
349336
}

0 commit comments

Comments
 (0)