diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c0ad63d4ab..996b7ab12b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Features +- Remove the aggregate Sentry Logs enable flag; manual `Sentry.logger()` calls now capture Logs by default ([#5947](https://github.com/getsentry/sentry-java/pull/5947)) - Add an explicit Logs opt-in to Spring Boot logging auto-configuration ([#5946](https://github.com/getsentry/sentry-java/pull/5946)) - Add an explicit Logs opt-in to the Android Logcat integration ([#5945](https://github.com/getsentry/sentry-java/pull/5945)) - Add an explicit Logs opt-in to the Android Timber integration ([#5943](https://github.com/getsentry/sentry-java/pull/5943)) diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java index 54db6ba0f3f..2bf1f1827a8 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java @@ -192,8 +192,6 @@ final class ManifestMetadataReader { static final String IN_APP_EXCLUDES = "io.sentry.in-app-excludes"; - static final String ENABLE_LOGS = "io.sentry.logs.enabled"; - static final String ENABLE_TIMBER_LOGS = "io.sentry.timber.logs.enabled"; static final String ENABLE_LOGCAT_LOGS = "io.sentry.logcat.logs.enabled"; @@ -754,10 +752,6 @@ static void applyMetadata( } } - options - .getLogs() - .setEnabled(readBool(metadata, logger, ENABLE_LOGS, options.getLogs().isEnabled())); - options.setEnableTimberLogs( readBool(metadata, logger, ENABLE_TIMBER_LOGS, options.isEnableTimberLogs())); diff --git a/sentry-android-core/src/main/java/io/sentry/android/core/SentryLogcatAdapter.java b/sentry-android-core/src/main/java/io/sentry/android/core/SentryLogcatAdapter.java index bab26e9c3e7..998ce58b3db 100644 --- a/sentry-android-core/src/main/java/io/sentry/android/core/SentryLogcatAdapter.java +++ b/sentry-android-core/src/main/java/io/sentry/android/core/SentryLogcatAdapter.java @@ -55,8 +55,7 @@ private static void addAsLog( final @NotNull ScopesAdapter scopes = ScopesAdapter.getInstance(); final @NotNull SentryOptions options = scopes.getOptions(); if (!(options instanceof SentryAndroidOptions) - || !((SentryAndroidOptions) options).isEnableLogcatLogs() - || !options.getLogs().isEnabled()) { + || !((SentryAndroidOptions) options).isEnableLogcatLogs()) { return; } final @Nullable String trMessage = tr != null ? tr.getMessage() : null; diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt index 56379366c33..91a1469702f 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt @@ -2175,31 +2175,6 @@ class ManifestMetadataReaderTest { assertTrue(fixture.options.inAppExcludes.isEmpty()) } - @Test - fun `applyMetadata reads logs enabled and keep default value if not found`() { - // Arrange - val context = fixture.getContext() - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertFalse(fixture.options.logs.isEnabled) - } - - @Test - fun `applyMetadata reads logs enabled to options`() { - // Arrange - val bundle = bundleOf(ManifestMetadataReader.ENABLE_LOGS to true) - val context = fixture.getContext(metaData = bundle) - - // Act - ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider) - - // Assert - assertTrue(fixture.options.logs.isEnabled) - } - @Test fun `applyMetadata keeps Timber logs disabled if not found`() { val context = fixture.getContext() diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/SentryLogcatAdapterTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/SentryLogcatAdapterTest.kt index 423df279f1e..582f475f68d 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/SentryLogcatAdapterTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/SentryLogcatAdapterTest.kt @@ -14,7 +14,6 @@ import java.lang.RuntimeException import kotlin.test.AfterTest import kotlin.test.Test import kotlin.test.assertEquals -import kotlin.test.assertTrue import org.junit.runner.RunWith import org.robolectric.shadows.ShadowLog @@ -40,7 +39,6 @@ class SentryLogcatAdapterTest { breadcrumbs.add(breadcrumb) breadcrumb } - it.logs.isEnabled = true if (enableLogcatLogs != null) { it.isEnableLogcatLogs = enableLogcatLogs } @@ -205,26 +203,6 @@ class SentryLogcatAdapterTest { .assert("$commonMsg wtf exception\n${throwable.message}", SentryLogLevel.FATAL) } - @Test - fun `do not send logs if logs is disabled`() { - fixture.initSut { it.logs.isEnabled = false } - - SentryLogcatAdapter.v(tag, "$commonMsg verbose") - SentryLogcatAdapter.i(tag, "$commonMsg info") - SentryLogcatAdapter.d(tag, "$commonMsg debug") - SentryLogcatAdapter.w(tag, "$commonMsg warning") - SentryLogcatAdapter.e(tag, "$commonMsg error") - SentryLogcatAdapter.wtf(tag, "$commonMsg wtf") - SentryLogcatAdapter.e(tag, "$commonMsg error exception", throwable) - SentryLogcatAdapter.v(tag, "$commonMsg verbose exception", throwable) - SentryLogcatAdapter.i(tag, "$commonMsg info exception", throwable) - SentryLogcatAdapter.d(tag, "$commonMsg debug exception", throwable) - SentryLogcatAdapter.w(tag, "$commonMsg warning exception", throwable) - SentryLogcatAdapter.wtf(tag, "$commonMsg wtf exception", throwable) - - assertTrue(fixture.logs.isEmpty()) - } - @Test fun `logs add correct number of breadcrumb`() { fixture.initSut() diff --git a/sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java b/sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java index 37ce146d3c6..c606bdf88b6 100644 --- a/sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java +++ b/sentry-jul/src/main/java/io/sentry/jul/SentryHandler.java @@ -114,9 +114,7 @@ public void publish(final @NotNull LogRecord record) { return; } try { - if (enableLogs - && ScopesAdapter.getInstance().getOptions().getLogs().isEnabled() - && record.getLevel().intValue() >= minimumLevel.intValue()) { + if (enableLogs && record.getLevel().intValue() >= minimumLevel.intValue()) { captureLog(record); } if (record.getLevel().intValue() >= minimumEventLevel.intValue()) { diff --git a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt index a169c710b0a..2cd10a81cd4 100644 --- a/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt +++ b/sentry-jul/src/test/kotlin/io/sentry/jul/SentryHandlerTest.kt @@ -42,7 +42,6 @@ class SentryHandlerTest { contextTags: List? = null, printfStyle: Boolean? = null, enableLogs: Boolean? = true, - enableGlobalLogs: Boolean = true, ) { var logger: Logger var handler: SentryHandler @@ -51,7 +50,6 @@ class SentryHandlerTest { val options = SentryOptions() options.dsn = "http://key@localhost/proj" options.setTransportFactory { _, _ -> transport } - options.logs.isEnabled = enableGlobalLogs options.logs.loggerBatchProcessorFactory = ILoggerBatchProcessorFactory { options, client -> LoggerBatchProcessor(options, client, ImmediateExecutorService()) } @@ -438,7 +436,7 @@ class SentryHandlerTest { @Test fun `does not capture logs by default`() { - fixture = Fixture(enableLogs = null, enableGlobalLogs = true) + fixture = Fixture(enableLogs = null) assertFalse(fixture.handler.isEnableLogs) fixture.logger.info("this should not be captured as a log") @@ -449,7 +447,7 @@ class SentryHandlerTest { @Test fun `captures logs when enabled through Java`() { - fixture = Fixture(enableLogs = true, enableGlobalLogs = true) + fixture = Fixture(enableLogs = true) assertTrue(fixture.handler.isEnableLogs) fixture.logger.info("this should be captured as a log") @@ -470,7 +468,6 @@ class SentryHandlerTest { minimumBreadcrumbLevel = Level.INFO, minimumEventLevel = Level.SEVERE, enableLogs = false, - enableGlobalLogs = true, ) fixture.logger.info("this should be a breadcrumb") diff --git a/sentry-jul/src/test/resources/sentry.properties b/sentry-jul/src/test/resources/sentry.properties index 0163b4f2f84..12c5db4eb9d 100644 --- a/sentry-jul/src/test/resources/sentry.properties +++ b/sentry-jul/src/test/resources/sentry.properties @@ -1,2 +1 @@ release=release from sentry.properties -logs.enabled=true 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 88ba3197780..ab1d59a7925 100644 --- a/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java +++ b/sentry-log4j2/src/main/java/io/sentry/log4j2/SentryAppender.java @@ -269,9 +269,7 @@ void start(final @NotNull Sentry.OptionsConfiguration optionsConf @Override public void append(final @NotNull LogEvent eventObject) { - if (enableLogs - && scopes.getOptions().getLogs().isEnabled() - && eventObject.getLevel().isMoreSpecificThan(minimumLevel)) { + if (enableLogs && eventObject.getLevel().isMoreSpecificThan(minimumLevel)) { captureLog(eventObject); } if (eventObject.getLevel().isMoreSpecificThan(minimumEventLevel)) { diff --git a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt index cb33115e647..fe5d3f4112c 100644 --- a/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt +++ b/sentry-log4j2/src/test/kotlin/io/sentry/log4j2/SentryAppenderTest.kt @@ -63,7 +63,6 @@ class SentryAppenderTest { debug: Boolean? = null, contextTags: List? = null, enableLogs: Boolean = true, - enableGlobalLogs: Boolean = true, ): ExtendedLogger { if (transportFactory != null) { this.transportFactory = transportFactory @@ -106,7 +105,6 @@ class SentryAppenderTest { appender.start( appender.getOptionsConfiguration { options -> - options.logs.isEnabled = enableGlobalLogs options.logs.loggerBatchProcessorFactory = ILoggerBatchProcessorFactory { options, client -> LoggerBatchProcessor(options, client, ImmediateExecutorService()) @@ -264,7 +262,7 @@ class SentryAppenderTest { @Test fun `does not capture logs when local logs are disabled`() { - val logger = fixture.getSut(enableLogs = false, enableGlobalLogs = true) + val logger = fixture.getSut(enableLogs = false) logger.info("this should not be captured as a log") Sentry.flush(10) @@ -273,8 +271,8 @@ class SentryAppenderTest { } @Test - fun `captures logs when local and aggregate logs are enabled`() { - val logger = fixture.getSut(enableLogs = true, enableGlobalLogs = true) + fun `captures logs when local logs are enabled`() { + val logger = fixture.getSut(enableLogs = true) logger.info("this should be captured as a log") Sentry.flush(10) @@ -294,7 +292,6 @@ class SentryAppenderTest { minimumBreadcrumbLevel = Level.INFO, minimumEventLevel = Level.ERROR, enableLogs = false, - enableGlobalLogs = true, ) logger.info("this should be a breadcrumb") @@ -397,7 +394,6 @@ class SentryAppenderTest { fun `plugin attribute enables logs with explicit opt in`() { initForTest { it.dsn = "http://key@localhost/proj" - it.logs.isEnabled = true } val event = mock() whenever(event.level).thenReturn(Level.INFO) diff --git a/sentry-log4j2/src/test/resources/sentry.properties b/sentry-log4j2/src/test/resources/sentry.properties index 9845650aace..ec87ba75304 100644 --- a/sentry-log4j2/src/test/resources/sentry.properties +++ b/sentry-log4j2/src/test/resources/sentry.properties @@ -1,4 +1,3 @@ release=release from sentry.properties -logs.enabled=true shutdown-timeout-millis=0 session-flush-timeout-millis=0 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 be857fc9754..81335ad02db 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -89,9 +89,7 @@ public void start() { @Override protected void append(@NotNull ILoggingEvent eventObject) { - if (enableLogs - && ScopesAdapter.getInstance().getOptions().getLogs().isEnabled() - && eventObject.getLevel().isGreaterOrEqual(minimumLevel)) { + if (enableLogs && eventObject.getLevel().isGreaterOrEqual(minimumLevel)) { captureLog(eventObject); } if (eventObject.getLevel().isGreaterOrEqual(minimumEventLevel)) { diff --git a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt index 21067c5b767..2bf05b12404 100644 --- a/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt +++ b/sentry-logback/src/test/kotlin/io/sentry/logback/SentryAppenderTest.kt @@ -58,7 +58,6 @@ class SentryAppenderTest { includeUnencodedMessage: Boolean = false, sendDefaultPii: Boolean = false, enableLogs: Boolean = false, - enableGlobalLogs: Boolean = enableLogs, options: SentryOptions = SentryOptions(), startLater: Boolean = false, ) { @@ -75,7 +74,6 @@ class SentryAppenderTest { this.encoder = encoder options.dsn = dsn options.isSendDefaultPii = sendDefaultPii - options.logs.isEnabled = enableGlobalLogs options.logs.loggerBatchProcessorFactory = ILoggerBatchProcessorFactory { options, client -> LoggerBatchProcessor(options, client, ImmediateExecutorService()) } @@ -414,8 +412,8 @@ class SentryAppenderTest { } @Test - fun `does not capture logs by default when aggregate logs are enabled`() { - fixture = Fixture(enableGlobalLogs = true) + fun `does not capture logs by default`() { + fixture = Fixture(enableLogs = false) assertFalse(fixture.appender.isEnableLogs) fixture.logger.info("this should not be captured as a log") @@ -425,7 +423,7 @@ class SentryAppenderTest { } @Test - fun `captures logs when local and aggregate logs are enabled`() { + fun `captures logs when local logs are enabled`() { fixture = Fixture(enableLogs = true) assertTrue(fixture.appender.isEnableLogs) @@ -446,7 +444,7 @@ class SentryAppenderTest { Fixture( minimumBreadcrumbLevel = Level.INFO, minimumEventLevel = Level.ERROR, - enableGlobalLogs = true, + enableLogs = false, ) fixture.logger.info("this should be a breadcrumb") diff --git a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml index 6426d03b814..965e74af57a 100644 --- a/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml +++ b/sentry-samples/sentry-samples-android/src/main/AndroidManifest.xml @@ -147,9 +147,14 @@ android:name="io.sentry.debug" android:value="${sentryDebug}" /> - + + + + diff --git a/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java index d973a68a907..3a21e8220c6 100644 --- a/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java +++ b/sentry-samples/sentry-samples-console-otlp/src/main/java/io/sentry/samples/console/Main.java @@ -133,7 +133,6 @@ public static void main(String[] args) throws InterruptedException { // } // }); - options.getLogs().setEnabled(true); }); Sentry.addBreadcrumb( diff --git a/sentry-samples/sentry-samples-jul/src/main/resources/sentry.properties b/sentry-samples/sentry-samples-jul/src/main/resources/sentry.properties index ac73ce04179..390771a4403 100644 --- a/sentry-samples/sentry-samples-jul/src/main/resources/sentry.properties +++ b/sentry-samples/sentry-samples-jul/src/main/resources/sentry.properties @@ -4,4 +4,3 @@ debug=true environment=staging in-app-includes=io.sentry.samples context-tags=userId,requestId -logs.enabled=true diff --git a/sentry-samples/sentry-samples-log4j2/src/main/resources/sentry.properties b/sentry-samples/sentry-samples-log4j2/src/main/resources/sentry.properties index b2310e08f89..a7dca6edc4e 100644 --- a/sentry-samples/sentry-samples-log4j2/src/main/resources/sentry.properties +++ b/sentry-samples/sentry-samples-log4j2/src/main/resources/sentry.properties @@ -1,3 +1,2 @@ in-app-includes="io.sentry.samples" -logs.enabled=true debug=true diff --git a/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml b/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml index 7b70bcda1c0..196486cf807 100644 --- a/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml +++ b/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml @@ -13,9 +13,6 @@ https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563 userId requestId - - true - true diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application.properties index 9e53be98324..d8b1bcd2bb6 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry-noagent/src/main/resources/application.properties @@ -15,7 +15,6 @@ sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties index 3d19e15d7cb..bf302c6dd05 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-opentelemetry/src/main/resources/application.properties @@ -15,7 +15,6 @@ sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties index 483ae19db6d..05a35327d86 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-otlp/src/main/resources/application.properties @@ -16,7 +16,6 @@ sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false sentry.in-app-includes="io.sentry.samples" -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces diff --git a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties index 130da1d07cb..2e897e5c714 100644 --- a/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4-webflux/src/main/resources/application.properties @@ -10,7 +10,6 @@ sentry.logging.minimum-breadcrumb-level=debug sentry.reactive.thread-local-accessor-enabled=true sentry.traces-sample-rate=1.0 sentry.enable-backpressure-handling=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.enable-spotlight=true sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties index d52b74778c0..40a5843c134 100644 --- a/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-4/src/main/resources/application.properties @@ -16,7 +16,6 @@ sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false sentry.in-app-includes="io.sentry.samples" -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties index 7512b72c554..7f5880b741a 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry-noagent/src/main/resources/application.properties @@ -15,7 +15,6 @@ sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties index 78b3894a49e..4b80755d846 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta-opentelemetry/src/main/resources/application.properties @@ -15,7 +15,6 @@ sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true sentry.enablePrettySerializationOutput=false -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties index 02c6cf72430..d71c2c433ab 100644 --- a/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-jakarta/src/main/resources/application.properties @@ -16,7 +16,6 @@ sentry.enable-backpressure-handling=true sentry.enable-spotlight=false sentry.enablePrettySerializationOutput=false sentry.in-app-includes="io.sentry.samples" -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.profile-session-sample-rate=1.0 sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application.properties index ab866094ebf..af217277c78 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry-noagent/src/main/resources/application.properties @@ -14,7 +14,6 @@ sentry.debug=true sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application.properties index 69b87411656..404549c12da 100644 --- a/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-opentelemetry/src/main/resources/application.properties @@ -14,7 +14,6 @@ sentry.debug=true sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties index d228dedf5ac..45d04440f88 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-webflux-jakarta/src/main/resources/application.properties @@ -10,7 +10,6 @@ sentry.logging.minimum-breadcrumb-level=debug sentry.reactive.thread-local-accessor-enabled=true sentry.traces-sample-rate=1.0 sentry.enable-backpressure-handling=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.enable-spotlight=true sentry.in-app-includes="io.sentry.samples" diff --git a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/resources/application.properties index 8e3517eb96a..5e85915a9c9 100644 --- a/sentry-samples/sentry-samples-spring-boot-webflux/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot-webflux/src/main/resources/application.properties @@ -12,7 +12,6 @@ spring.graphql.graphiql.enabled=true spring.graphql.websocket.path=/graphql spring.graphql.schema.printer.enabled=true sentry.enable-backpressure-handling=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.enable-spotlight=true sentry.in-app-includes="io.sentry.samples" diff --git a/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties index b02107af7e0..bce0ce41f53 100644 --- a/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties +++ b/sentry-samples/sentry-samples-spring-boot/src/main/resources/application.properties @@ -14,7 +14,6 @@ sentry.debug=true sentry.graphql.ignored-error-types=SOME_ERROR,ANOTHER_ERROR sentry.enable-backpressure-handling=true sentry.enable-spotlight=true -sentry.logs.enabled=true sentry.logging.enable-logs=true sentry.in-app-includes="io.sentry.samples" sentry.profile-session-sample-rate=1.0 diff --git a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt index 3fc2d93ca76..e8ec76cdbbb 100644 --- a/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt @@ -244,7 +244,6 @@ class SentryAutoConfigurationTest { "sentry.cron.default-timezone=America/New_York", "sentry.cron.default-failure-issue-threshold=40", "sentry.cron.default-recovery-threshold=50", - "sentry.logs.enabled=true", "sentry.logging.enable-logs=true", "sentry.strict-trace-continuation=true", "sentry.org-id=12345", @@ -302,7 +301,6 @@ class SentryAutoConfigurationTest { assertThat(options.cron!!.defaultTimezone).isEqualTo("America/New_York") assertThat(options.cron!!.defaultFailureIssueThreshold).isEqualTo(40L) assertThat(options.cron!!.defaultRecoveryThreshold).isEqualTo(50L) - assertThat(options.logs.isEnabled).isEqualTo(true) assertThat(options.logging.isEnableLogs).isTrue() assertThat(options.isStrictTraceContinuation).isEqualTo(true) assertThat(options.orgId).isEqualTo("12345") diff --git a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt index 815a529ee34..6d584c9d609 100644 --- a/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt @@ -246,7 +246,6 @@ class SentryAutoConfigurationTest { "sentry.cron.default-timezone=America/New_York", "sentry.cron.default-failure-issue-threshold=40", "sentry.cron.default-recovery-threshold=50", - "sentry.logs.enabled=true", "sentry.logging.enable-logs=true", "sentry.profile-session-sample-rate=1.0", "sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces", @@ -306,7 +305,6 @@ class SentryAutoConfigurationTest { assertThat(options.cron!!.defaultTimezone).isEqualTo("America/New_York") assertThat(options.cron!!.defaultFailureIssueThreshold).isEqualTo(40L) assertThat(options.cron!!.defaultRecoveryThreshold).isEqualTo(50L) - assertThat(options.logs.isEnabled).isEqualTo(true) assertThat(options.logging.isEnableLogs).isTrue() assertThat(options.profileSessionSampleRate).isEqualTo(1.0) assertThat(options.profilingTracesDirPath) diff --git a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt index c224231b196..bdc166c15e3 100644 --- a/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt +++ b/sentry-spring-boot/src/test/kotlin/io/sentry/spring/boot/SentryAutoConfigurationTest.kt @@ -244,7 +244,6 @@ class SentryAutoConfigurationTest { "sentry.cron.default-timezone=America/New_York", "sentry.cron.default-failure-issue-threshold=40", "sentry.cron.default-recovery-threshold=50", - "sentry.logs.enabled=true", "sentry.logging.enable-logs=true", "sentry.profile-session-sample-rate=1.0", "sentry.profiling-traces-dir-path=tmp/sentry/profiling-traces", @@ -304,7 +303,6 @@ class SentryAutoConfigurationTest { assertThat(options.cron!!.defaultTimezone).isEqualTo("America/New_York") assertThat(options.cron!!.defaultFailureIssueThreshold).isEqualTo(40L) assertThat(options.cron!!.defaultRecoveryThreshold).isEqualTo(50L) - assertThat(options.logs.isEnabled).isEqualTo(true) assertThat(options.logging.isEnableLogs).isTrue() assertThat(options.profileSessionSampleRate).isEqualTo(1.0) assertThat(options.profilingTracesDirPath) diff --git a/sentry/api/sentry.api b/sentry/api/sentry.api index 53452c4c3b9..09b2c74e5a5 100644 --- a/sentry/api/sentry.api +++ b/sentry/api/sentry.api @@ -590,7 +590,6 @@ public final class io/sentry/ExternalOptions { public fun isEnableBackpressureHandling ()Ljava/lang/Boolean; public fun isEnableCacheTracing ()Ljava/lang/Boolean; public fun isEnableDatabaseTransactionTracing ()Ljava/lang/Boolean; - public fun isEnableLogs ()Ljava/lang/Boolean; public fun isEnableMetrics ()Ljava/lang/Boolean; public fun isEnablePrettySerializationOutput ()Ljava/lang/Boolean; public fun isEnableQueueTracing ()Ljava/lang/Boolean; @@ -611,7 +610,6 @@ public final class io/sentry/ExternalOptions { public fun setEnableCacheTracing (Ljava/lang/Boolean;)V public fun setEnableDatabaseTransactionTracing (Ljava/lang/Boolean;)V public fun setEnableDeduplication (Ljava/lang/Boolean;)V - public fun setEnableLogs (Ljava/lang/Boolean;)V public fun setEnableMetrics (Ljava/lang/Boolean;)V public fun setEnablePrettySerializationOutput (Ljava/lang/Boolean;)V public fun setEnableQueueTracing (Ljava/lang/Boolean;)V @@ -4100,9 +4098,7 @@ public final class io/sentry/SentryOptions$Logs { public fun ()V public fun getBeforeSend ()Lio/sentry/SentryOptions$Logs$BeforeSendLogCallback; public fun getLoggerBatchProcessorFactory ()Lio/sentry/logger/ILoggerBatchProcessorFactory; - public fun isEnabled ()Z public fun setBeforeSend (Lio/sentry/SentryOptions$Logs$BeforeSendLogCallback;)V - public fun setEnabled (Z)V public fun setLoggerBatchProcessorFactory (Lio/sentry/logger/ILoggerBatchProcessorFactory;)V } @@ -5568,13 +5564,6 @@ public final class io/sentry/logger/NoOpLoggerApi : io/sentry/logger/ILoggerApi public fun warn (Ljava/lang/String;[Ljava/lang/Object;)V } -public final class io/sentry/logger/NoOpLoggerBatchProcessor : io/sentry/logger/ILoggerBatchProcessor { - public fun add (Lio/sentry/SentryLogEvent;)V - public fun close (Z)V - public fun flush (J)V - public static fun getInstance ()Lio/sentry/logger/NoOpLoggerBatchProcessor; -} - public final class io/sentry/logger/SentryLogParameters { public fun ()V public static fun create (Lio/sentry/SentryAttributes;)Lio/sentry/logger/SentryLogParameters; diff --git a/sentry/src/main/java/io/sentry/ExternalOptions.java b/sentry/src/main/java/io/sentry/ExternalOptions.java index 272cf1c13a9..1bfec0f05b4 100644 --- a/sentry/src/main/java/io/sentry/ExternalOptions.java +++ b/sentry/src/main/java/io/sentry/ExternalOptions.java @@ -46,7 +46,6 @@ public final class ExternalOptions { private @Nullable Boolean enabled; private @Nullable Boolean enablePrettySerializationOutput; private @Nullable Boolean enableSpotlight; - private @Nullable Boolean enableLogs; private @Nullable Boolean enableMetrics; private @Nullable String spotlightConnectionUrl; @@ -178,8 +177,6 @@ public final class ExternalOptions { options.setCaptureOpenTelemetryEvents( propertiesProvider.getBooleanProperty("capture-open-telemetry-events")); - options.setEnableLogs(propertiesProvider.getBooleanProperty("logs.enabled")); - options.setEnableMetrics(propertiesProvider.getBooleanProperty("metrics.enabled")); for (final String ignoredExceptionType : @@ -717,14 +714,6 @@ public void setCaptureOpenTelemetryEvents(final @Nullable Boolean captureOpenTel return captureOpenTelemetryEvents; } - public void setEnableLogs(final @Nullable Boolean enableLogs) { - this.enableLogs = enableLogs; - } - - public @Nullable Boolean isEnableLogs() { - return enableLogs; - } - public void setEnableMetrics(final @Nullable Boolean enableMetrics) { this.enableMetrics = enableMetrics; } diff --git a/sentry/src/main/java/io/sentry/SentryClient.java b/sentry/src/main/java/io/sentry/SentryClient.java index 4bba195feea..8a2fe2ed6df 100644 --- a/sentry/src/main/java/io/sentry/SentryClient.java +++ b/sentry/src/main/java/io/sentry/SentryClient.java @@ -9,7 +9,6 @@ import io.sentry.hints.DiskFlushNotification; import io.sentry.hints.TransactionEnd; import io.sentry.logger.ILoggerBatchProcessor; -import io.sentry.logger.NoOpLoggerBatchProcessor; import io.sentry.metrics.IMetricsBatchProcessor; import io.sentry.metrics.NoOpMetricsBatchProcessor; import io.sentry.protocol.Contexts; @@ -60,12 +59,7 @@ public SentryClient(final @NotNull SentryOptions options) { final RequestDetailsResolver requestDetailsResolver = new RequestDetailsResolver(options); transport = transportFactory.create(options, requestDetailsResolver.resolve()); - if (options.getLogs().isEnabled()) { - loggerBatchProcessor = - options.getLogs().getLoggerBatchProcessorFactory().create(options, this); - } else { - loggerBatchProcessor = NoOpLoggerBatchProcessor.getInstance(); - } + loggerBatchProcessor = options.getLogs().getLoggerBatchProcessorFactory().create(options, this); if (options.getMetrics().isEnabled()) { metricsBatchProcessor = options.getMetrics().getMetricsBatchProcessorFactory().create(options, this); diff --git a/sentry/src/main/java/io/sentry/SentryOptions.java b/sentry/src/main/java/io/sentry/SentryOptions.java index 6dacb527276..adb35d35ba8 100644 --- a/sentry/src/main/java/io/sentry/SentryOptions.java +++ b/sentry/src/main/java/io/sentry/SentryOptions.java @@ -3834,10 +3834,6 @@ public void merge(final @NotNull ExternalOptions options) { } } - if (options.isEnableLogs() != null) { - getLogs().setEnabled(options.isEnableLogs()); - } - if (options.isEnableMetrics() != null) { getMetrics().setEnabled(options.isEnableMetrics()); } @@ -4092,9 +4088,6 @@ public void setDefaultRecoveryThreshold(@Nullable Long defaultRecoveryThreshold) public static final class Logs { - /** Whether Sentry Logs feature is enabled and Sentry.logger() usages are sent to Sentry. */ - private boolean enable = false; - /** * This function is called with an SDK specific log event object and can return a modified event * object or nothing to skip reporting the log item @@ -4104,24 +4097,6 @@ public static final class Logs { private @NotNull ILoggerBatchProcessorFactory loggerBatchProcessorFactory = new DefaultLoggerBatchProcessorFactory(); - /** - * Whether Sentry Logs feature is enabled and Sentry.logger() usages are sent to Sentry. - * - * @return true if Sentry Logs should be enabled - */ - public boolean isEnabled() { - return enable; - } - - /** - * Whether Sentry Logs feature is enabled and Sentry.logger() usages are sent to Sentry. - * - * @param enableLogs true if Sentry Logs should be enabled - */ - public void setEnabled(boolean enableLogs) { - this.enable = enableLogs; - } - /** * Returns the BeforeSendLog callback * diff --git a/sentry/src/main/java/io/sentry/logger/LoggerApi.java b/sentry/src/main/java/io/sentry/logger/LoggerApi.java index c203dcbfb8f..3741ddc6209 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerApi.java @@ -104,13 +104,6 @@ private void captureLog( return; } - if (!options.getLogs().isEnabled()) { - options - .getLogger() - .log(SentryLevel.WARNING, "Sentry Log is disabled and this 'logger' call is a no-op."); - return; - } - if (message == null) { return; } diff --git a/sentry/src/main/java/io/sentry/logger/NoOpLoggerBatchProcessor.java b/sentry/src/main/java/io/sentry/logger/NoOpLoggerBatchProcessor.java deleted file mode 100644 index 68dc4ecf937..00000000000 --- a/sentry/src/main/java/io/sentry/logger/NoOpLoggerBatchProcessor.java +++ /dev/null @@ -1,32 +0,0 @@ -package io.sentry.logger; - -import io.sentry.SentryLogEvent; -import org.jetbrains.annotations.ApiStatus; -import org.jetbrains.annotations.NotNull; - -@ApiStatus.Internal -public final class NoOpLoggerBatchProcessor implements ILoggerBatchProcessor { - - private static final NoOpLoggerBatchProcessor instance = new NoOpLoggerBatchProcessor(); - - private NoOpLoggerBatchProcessor() {} - - public static NoOpLoggerBatchProcessor getInstance() { - return instance; - } - - @Override - public void add(@NotNull SentryLogEvent event) { - // do nothing - } - - @Override - public void close(final boolean isRestarting) { - // do nothing - } - - @Override - public void flush(long timeoutMillis) { - // do nothing - } -} diff --git a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt index cdd184b181f..1d99f810747 100644 --- a/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/ExternalOptionsTest.kt @@ -530,11 +530,6 @@ class ExternalOptionsTest { } } - @Test - fun `creates options with enableLogs set to true`() { - withPropertiesFile("logs.enabled=true") { options -> assertTrue(options.isEnableLogs == true) } - } - @Test fun `creates options with enableMetrics set to true`() { withPropertiesFile("metrics.enabled=true") { options -> diff --git a/sentry/src/test/java/io/sentry/ScopesTest.kt b/sentry/src/test/java/io/sentry/ScopesTest.kt index d1cb38c6495..5747aa11893 100644 --- a/sentry/src/test/java/io/sentry/ScopesTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesTest.kt @@ -2528,16 +2528,8 @@ class ScopesTest { @Test fun `when captureLog is called on disabled client, do nothing`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } - sut.close() - - sut.logger().warn("test message") - verify(mockClient, never()).captureLog(any(), anyOrNull()) - } - - @Test - fun `when logging is not enabled, do nothing`() { val (sut, mockClient) = getEnabledScopes() + sut.close() sut.logger().warn("test message") verify(mockClient, never()).captureLog(any(), anyOrNull()) @@ -2545,7 +2537,7 @@ class ScopesTest { @Test fun `capturing null log does nothing`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().warn(null) verify(mockClient, never()).captureLog(any(), anyOrNull()) @@ -2553,7 +2545,7 @@ class ScopesTest { @Test fun `creating trace log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().trace("trace log message") @@ -2570,7 +2562,7 @@ class ScopesTest { @Test fun `creating debug log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().debug("debug log message") @@ -2587,7 +2579,7 @@ class ScopesTest { @Test fun `creating a info log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().info("info log message") @@ -2604,7 +2596,7 @@ class ScopesTest { @Test fun `creating warn log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().warn("warn log message") @@ -2621,7 +2613,7 @@ class ScopesTest { @Test fun `creating error log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().error("error log message") @@ -2638,7 +2630,7 @@ class ScopesTest { @Test fun `creating fatal log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().fatal("fatal log message") @@ -2655,7 +2647,7 @@ class ScopesTest { @Test fun `creating log works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log message") @@ -2672,7 +2664,7 @@ class ScopesTest { @Test fun `log with manual origin does not have origin attribute`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log message") @@ -2688,7 +2680,7 @@ class ScopesTest { @Test fun `log with non manual origin does have origin attribute`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .logger() @@ -2711,7 +2703,6 @@ class ScopesTest { fun `creating log with format string works`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.environment = "testenv" it.release = "1.0" it.serverName = "srv1" @@ -2752,7 +2743,7 @@ class ScopesTest { @Test fun `creating log with timestamp works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, SentryLongDate(123), "log message") @@ -2770,7 +2761,7 @@ class ScopesTest { @Test fun `creating log with attributes from map works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .logger() @@ -2797,7 +2788,7 @@ class ScopesTest { @Test fun `creating log with attributes works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .logger() @@ -2873,7 +2864,7 @@ class ScopesTest { @Test fun `creating log with attributes and timestamp works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .logger() @@ -2904,7 +2895,7 @@ class ScopesTest { @Test fun `creating log with attributes and timestamp and format string works`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .logger() @@ -2959,7 +2950,7 @@ class ScopesTest { @Test fun `creating log with without args does not add template attribute`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log %s") @@ -2982,7 +2973,7 @@ class ScopesTest { @Test fun `captures format string on format error`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log %d", "arg1") @@ -3009,7 +3000,6 @@ class ScopesTest { fun `adds user fields to log attributes if sendDefaultPii is true`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.distinctId = "distinctId" it.isSendDefaultPii = true } @@ -3049,7 +3039,6 @@ class ScopesTest { fun `adds user fields to log attributes even if sendDefaultPii is false`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.distinctId = "distinctId" } @@ -3088,7 +3077,6 @@ class ScopesTest { fun `unset user does provide distinct-id as user-id`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.distinctId = "distinctId" } @@ -3111,7 +3099,6 @@ class ScopesTest { fun `unset user does provide null user-id when distinct-id is missing`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.distinctId = null } @@ -3133,7 +3120,6 @@ class ScopesTest { fun `missing user fields do not break attributes`() { val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.isSendDefaultPii = true it.distinctId = "distinctId" } @@ -3156,7 +3142,7 @@ class ScopesTest { @Test fun `adds session replay id to log attributes`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() val replayId = SentryId() sut.scope.replayId = replayId sut.logger().log(SentryLogLevel.WARN, "log message") @@ -3174,7 +3160,7 @@ class ScopesTest { @Test fun `missing session replay id do not break attributes`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log message") verify(mockClient) @@ -3190,7 +3176,7 @@ class ScopesTest { @Test fun `does not add session replay buffering to log attributes if no replay id in scope and in controller`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut.logger().log(SentryLogLevel.WARN, "log message") assertEquals(SentryId.EMPTY_ID, sut.options.replayController.replayId) @@ -3210,7 +3196,7 @@ class ScopesTest { @Test fun `does not add session replay buffering to log attributes if replay id in scope`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() val replayId = SentryId() sut.scope.replayId = replayId @@ -3234,7 +3220,6 @@ class ScopesTest { val mockReplayController = mock() val (sut, mockClient) = getEnabledScopes { - it.logs.isEnabled = true it.setReplayController(mockReplayController) } val replayId = SentryId() @@ -3258,7 +3243,7 @@ class ScopesTest { @Test fun `log event has spanId from active span`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() val transaction = sut.startTransaction( @@ -3284,7 +3269,7 @@ class ScopesTest { @Test fun `log event has spanId from propagation context when no active span`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() var propagationContext: PropagationContext? = null sut.configureScope { propagationContext = it.propagationContext } @@ -3396,7 +3381,7 @@ class ScopesTest { @Test fun `metric with non manual origin does have origin attribute`() { - val (sut, mockClient) = getEnabledScopes { it.logs.isEnabled = true } + val (sut, mockClient) = getEnabledScopes() sut .metrics() diff --git a/sentry/src/test/java/io/sentry/SentryClientTest.kt b/sentry/src/test/java/io/sentry/SentryClientTest.kt index 61181ee96a6..9e0cc187938 100644 --- a/sentry/src/test/java/io/sentry/SentryClientTest.kt +++ b/sentry/src/test/java/io/sentry/SentryClientTest.kt @@ -181,7 +181,7 @@ class SentryClientTest { @Test fun `when client is closed with isRestarting false, transport waits`() { - val sut = fixture.getSut { options -> options.logs.isEnabled = true } + val sut = fixture.getSut() assertTrue(sut.isEnabled) sut.close(false) assertNotEquals(0, fixture.sentryOptions.shutdownTimeoutMillis) @@ -195,7 +195,7 @@ class SentryClientTest { @Test fun `when client is closed with isRestarting true, transport does not wait`() { - val sut = fixture.getSut { options -> options.logs.isEnabled = true } + val sut = fixture.getSut() assertTrue(sut.isEnabled) sut.close(true) verify(fixture.transport).flush(eq(0)) @@ -297,7 +297,6 @@ class SentryClientTest { @Test fun `when beforeSend captures a log, the nested log is dropped`() { val scope = createScope() - fixture.sentryOptions.logs.isEnabled = true lateinit var sut: SentryClient fixture.sentryOptions.setBeforeSend { e, _ -> sut.captureLog( @@ -318,7 +317,6 @@ class SentryClientTest { @Test fun `when beforeSendLog logs again, the nested log is dropped and does not recurse`() { val scope = createScope() - fixture.sentryOptions.logs.isEnabled = true var invocations = 0 lateinit var sut: SentryClient fixture.sentryOptions.logs.setBeforeSend { l -> diff --git a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt index 6b47d36e53d..ac16dc7e941 100644 --- a/sentry/src/test/java/io/sentry/SentryOptionsTest.kt +++ b/sentry/src/test/java/io/sentry/SentryOptionsTest.kt @@ -579,7 +579,6 @@ class SentryOptionsTest { externalOptions.isEnableSpotlight = true externalOptions.spotlightConnectionUrl = "http://local.sentry.io:1234" externalOptions.isGlobalHubMode = true - externalOptions.isEnableLogs = true externalOptions.isEnableMetrics = false externalOptions.profileSessionSampleRate = 0.8 externalOptions.profilingTracesDirPath = "/profiling-traces" @@ -643,7 +642,6 @@ class SentryOptionsTest { assertTrue(options.isEnableSpotlight) assertEquals("http://local.sentry.io:1234", options.spotlightConnectionUrl) assertTrue(options.isGlobalHubMode!!) - assertTrue(options.logs.isEnabled!!) assertFalse(options.metrics.isEnabled) assertEquals(0.8, options.profileSessionSampleRate) assertEquals("/profiling-traces${File.separator}${hash}", options.profilingTracesDirPath)