Skip to content

Commit 136a434

Browse files
committed
chore(stack): Merge preceding stack changes
# Conflicts: # sentry/src/main/java/io/sentry/SentryOptions.java # sentry/src/test/java/io/sentry/SentryOptionsTest.kt
2 parents 818d660 + d8a1618 commit 136a434

13 files changed

Lines changed: 4 additions & 463 deletions

File tree

‎sentry-android-core/src/main/java/io/sentry/android/core/ManifestMetadataReader.java‎

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ final class ManifestMetadataReader {
192192

193193
static final String IN_APP_EXCLUDES = "io.sentry.in-app-excludes";
194194

195-
static final String ENABLE_LOGS = "io.sentry.logs.enabled";
196-
197195
static final String ENABLE_TIMBER_LOGS = "io.sentry.timber.logs.enabled";
198196

199197
static final String ENABLE_LOGCAT_LOGS = "io.sentry.logcat.logs.enabled";
@@ -754,23 +752,6 @@ static void applyMetadata(
754752
}
755753
}
756754

757-
if (containsKey(metadata, ENABLE_LOGS)) {
758-
final boolean enableLogs = readBool(metadata, logger, ENABLE_LOGS, false);
759-
if (enableLogs) {
760-
logger.log(
761-
SentryLevel.WARNING,
762-
"The Android manifest option 'io.sentry.logs.enabled' is no longer supported. "
763-
+ "Manual Sentry.logger() calls no longer require it, and automatic logging "
764-
+ "integrations now require their own opt-ins.");
765-
} else {
766-
logger.log(
767-
SentryLevel.WARNING,
768-
"The Android manifest option 'io.sentry.logs.enabled' no longer disables manual "
769-
+ "Sentry.logger() calls. Automatic logging integrations remain disabled "
770-
+ "unless enabled through their own opt-ins.");
771-
}
772-
}
773-
774755
options.setEnableTimberLogs(
775756
readBool(metadata, logger, ENABLE_TIMBER_LOGS, options.isEnableTimberLogs()));
776757

‎sentry-android-core/src/test/java/io/sentry/android/core/ManifestMetadataReaderTest.kt‎

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import org.mockito.kotlin.verifyNoInteractions
3636
class ManifestMetadataReaderTest {
3737
private class Fixture {
3838
val logger = mock<ILogger>()
39-
val options = SentryAndroidOptions().apply { setLogger(this@Fixture.logger) }
39+
val options = SentryAndroidOptions().apply { setLogger(logger) }
4040
val buildInfoProvider = mock<BuildInfoProvider>()
4141

4242
fun getContext(metaData: Bundle = Bundle()): Context =
@@ -2178,64 +2178,6 @@ class ManifestMetadataReaderTest {
21782178
assertTrue(fixture.options.inAppExcludes.isEmpty())
21792179
}
21802180

2181-
@Test
2182-
fun `applyMetadata does not warn when legacy logs enabled metadata is absent`() {
2183-
fixture.options.isDebug = true
2184-
val context = fixture.getContext()
2185-
2186-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2187-
2188-
verify(fixture.logger, never()).log(eq(SentryLevel.WARNING), any<String>())
2189-
}
2190-
2191-
@Test
2192-
fun `applyMetadata warns when legacy logs enabled metadata is true`() {
2193-
val bundle =
2194-
bundleOf(
2195-
ManifestMetadataReader.DEBUG to true,
2196-
ManifestMetadataReader.ENABLE_LOGS to true,
2197-
)
2198-
val context = fixture.getContext(metaData = bundle)
2199-
2200-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2201-
2202-
verify(fixture.logger)
2203-
.log(
2204-
SentryLevel.WARNING,
2205-
"The Android manifest option 'io.sentry.logs.enabled' is no longer supported. " +
2206-
"Manual Sentry.logger() calls no longer require it, and automatic logging " +
2207-
"integrations now require their own opt-ins.",
2208-
*emptyArray(),
2209-
)
2210-
assertThat(fixture.options.isEnableTimberLogs).isFalse()
2211-
assertThat(fixture.options.isEnableLogcatLogs).isFalse()
2212-
}
2213-
2214-
@Test
2215-
fun `applyMetadata warns when legacy logs enabled metadata is false`() {
2216-
fixture.options.isEnableTimberLogs = true
2217-
fixture.options.isEnableLogcatLogs = true
2218-
val bundle =
2219-
bundleOf(
2220-
ManifestMetadataReader.DEBUG to true,
2221-
ManifestMetadataReader.ENABLE_LOGS to false,
2222-
)
2223-
val context = fixture.getContext(metaData = bundle)
2224-
2225-
ManifestMetadataReader.applyMetadata(context, fixture.options, fixture.buildInfoProvider)
2226-
2227-
verify(fixture.logger)
2228-
.log(
2229-
SentryLevel.WARNING,
2230-
"The Android manifest option 'io.sentry.logs.enabled' no longer disables manual " +
2231-
"Sentry.logger() calls. Automatic logging integrations remain disabled unless " +
2232-
"enabled through their own opt-ins.",
2233-
*emptyArray(),
2234-
)
2235-
assertThat(fixture.options.isEnableTimberLogs).isTrue()
2236-
assertThat(fixture.options.isEnableLogcatLogs).isTrue()
2237-
}
2238-
22392181
@Test
22402182
fun `applyMetadata keeps Timber logs disabled if not found`() {
22412183
val context = fixture.getContext()

‎sentry-spring-boot-4/src/main/java/io/sentry/spring/boot4/SentryAutoConfiguration.java‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.sentry.ScopesAdapter;
1212
import io.sentry.Sentry;
1313
import io.sentry.SentryIntegrationPackageStorage;
14-
import io.sentry.SentryLevel;
1514
import io.sentry.SentryOptions;
1615
import io.sentry.protocol.SdkVersion;
1716
import io.sentry.quartz.SentryJobListener;
@@ -164,8 +163,7 @@ static class OpenTelemetryNoAgentConfiguration {}
164163
final @NotNull List<Sentry.OptionsConfiguration<SentryOptions>> optionsConfigurations,
165164
final @NotNull SentryProperties options,
166165
final @NotNull ObjectProvider<ISpanFactory> spanFactory,
167-
final @NotNull ObjectProvider<GitProperties> gitProperties,
168-
final @NotNull Environment environment) {
166+
final @NotNull ObjectProvider<GitProperties> gitProperties) {
169167
optionsConfigurations.forEach(
170168
optionsConfiguration -> optionsConfiguration.configure(options));
171169
gitProperties.ifAvailable(
@@ -187,35 +185,9 @@ static class OpenTelemetryNoAgentConfiguration {}
187185
// here we make sure that only classes that extend throwable are set on this field
188186
options.getIgnoredExceptionsForType().removeIf(it -> !Throwable.class.isAssignableFrom(it));
189187
Sentry.init(options);
190-
warnForLegacyLogsConfiguration(environment, options);
191188
return ScopesAdapter.getInstance();
192189
}
193190

194-
private void warnForLegacyLogsConfiguration(
195-
final @NotNull Environment environment, final @NotNull SentryOptions options) {
196-
if (environment.containsProperty("sentry.logs.enabled")) {
197-
final boolean enableLogs =
198-
Boolean.TRUE.equals(environment.getProperty("sentry.logs.enabled", Boolean.class));
199-
if (enableLogs) {
200-
options
201-
.getLogger()
202-
.log(
203-
SentryLevel.WARNING,
204-
"The 'sentry.logs.enabled' property is no longer supported. Manual "
205-
+ "Sentry.logger() calls no longer require it, and automatic logging "
206-
+ "integrations now require their own opt-ins.");
207-
} else {
208-
options
209-
.getLogger()
210-
.log(
211-
SentryLevel.WARNING,
212-
"The 'sentry.logs.enabled' property no longer disables manual Sentry.logger() "
213-
+ "calls. Automatic logging integrations remain disabled unless enabled "
214-
+ "through their own opt-ins.");
215-
}
216-
}
217-
}
218-
219191
@Configuration(proxyBeanMethods = false)
220192
@ConditionalOnClass(MDC.class)
221193
@Open

‎sentry-spring-boot-4/src/test/kotlin/io/sentry/spring/boot4/SentryAutoConfigurationTest.kt‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import io.sentry.EventProcessor
88
import io.sentry.FilterString
99
import io.sentry.Hint
1010
import io.sentry.IContinuousProfiler
11-
import io.sentry.ILogger
1211
import io.sentry.IProfileConverter
1312
import io.sentry.IScopes
1413
import io.sentry.ITransportFactory
@@ -58,9 +57,7 @@ import org.assertj.core.api.Assertions.assertThat
5857
import org.mockito.internal.util.MockUtil.isMock
5958
import org.mockito.kotlin.any
6059
import org.mockito.kotlin.anyOrNull
61-
import org.mockito.kotlin.eq
6260
import org.mockito.kotlin.mock
63-
import org.mockito.kotlin.never
6461
import org.mockito.kotlin.verify
6562
import org.mockito.kotlin.whenever
6663
import org.quartz.JobExecutionContext
@@ -198,56 +195,6 @@ class SentryAutoConfigurationTest {
198195
}
199196
}
200197

201-
@Test
202-
fun `legacy logs property emits no warning when absent`() {
203-
val logger = mock<ILogger>()
204-
dsnEnabledRunner
205-
.withPropertyValues("sentry.debug=true")
206-
.withBean(ILogger::class.java, { logger })
207-
.withUserConfiguration(LoggerConfiguration::class.java)
208-
.run { verify(logger, never()).log(eq(SentryLevel.WARNING), any<String>()) }
209-
}
210-
211-
@Test
212-
fun `legacy logs property true emits migration warning`() {
213-
val logger = mock<ILogger>()
214-
dsnEnabledRunner
215-
.withPropertyValues("sentry.debug=true", "sentry.logs.enabled=true")
216-
.withBean(ILogger::class.java, { logger })
217-
.withUserConfiguration(LoggerConfiguration::class.java)
218-
.run {
219-
verify(logger)
220-
.log(
221-
SentryLevel.WARNING,
222-
"The 'sentry.logs.enabled' property is no longer supported. Manual " +
223-
"Sentry.logger() calls no longer require it, and automatic logging " +
224-
"integrations now require their own opt-ins.",
225-
*emptyArray(),
226-
)
227-
assertThat(it.getBean(SentryProperties::class.java).logging.isEnableLogs).isFalse()
228-
}
229-
}
230-
231-
@Test
232-
fun `legacy logs property false emits migration warning`() {
233-
val logger = mock<ILogger>()
234-
dsnEnabledRunner
235-
.withPropertyValues("sentry.debug=true", "sentry.logs.enabled=false")
236-
.withBean(ILogger::class.java, { logger })
237-
.withUserConfiguration(LoggerConfiguration::class.java)
238-
.run {
239-
verify(logger)
240-
.log(
241-
SentryLevel.WARNING,
242-
"The 'sentry.logs.enabled' property no longer disables manual Sentry.logger() " +
243-
"calls. Automatic logging integrations remain disabled unless enabled through " +
244-
"their own opt-ins.",
245-
*emptyArray(),
246-
)
247-
assertThat(it.getBean(SentryProperties::class.java).logging.isEnableLogs).isFalse()
248-
}
249-
}
250-
251198
@Test
252199
fun `properties are applied to SentryOptions`() {
253200
contextRunner
@@ -1369,13 +1316,6 @@ class SentryAutoConfigurationTest {
13691316
@Bean open fun sentryTransport() = transport
13701317
}
13711318

1372-
@Configuration(proxyBeanMethods = false)
1373-
open class LoggerConfiguration {
1374-
@Bean
1375-
open fun loggerConfiguration(logger: ILogger) =
1376-
Sentry.OptionsConfiguration<SentryOptions> { it.setLogger(logger) }
1377-
}
1378-
13791319
@Configuration(proxyBeanMethods = false)
13801320
open class NoOpTransportConfiguration {
13811321

‎sentry-spring-boot-jakarta/src/main/java/io/sentry/spring/boot/jakarta/SentryAutoConfiguration.java‎

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.sentry.ScopesAdapter;
1212
import io.sentry.Sentry;
1313
import io.sentry.SentryIntegrationPackageStorage;
14-
import io.sentry.SentryLevel;
1514
import io.sentry.SentryOptions;
1615
import io.sentry.protocol.SdkVersion;
1716
import io.sentry.quartz.SentryJobListener;
@@ -166,8 +165,7 @@ static class OpenTelemetryNoAgentConfiguration {}
166165
final @NotNull List<Sentry.OptionsConfiguration<SentryOptions>> optionsConfigurations,
167166
final @NotNull SentryProperties options,
168167
final @NotNull ObjectProvider<ISpanFactory> spanFactory,
169-
final @NotNull ObjectProvider<GitProperties> gitProperties,
170-
final @NotNull Environment environment) {
168+
final @NotNull ObjectProvider<GitProperties> gitProperties) {
171169
optionsConfigurations.forEach(
172170
optionsConfiguration -> optionsConfiguration.configure(options));
173171
gitProperties.ifAvailable(
@@ -189,35 +187,9 @@ static class OpenTelemetryNoAgentConfiguration {}
189187
// here we make sure that only classes that extend throwable are set on this field
190188
options.getIgnoredExceptionsForType().removeIf(it -> !Throwable.class.isAssignableFrom(it));
191189
Sentry.init(options);
192-
warnForLegacyLogsConfiguration(environment, options);
193190
return ScopesAdapter.getInstance();
194191
}
195192

196-
private void warnForLegacyLogsConfiguration(
197-
final @NotNull Environment environment, final @NotNull SentryOptions options) {
198-
if (environment.containsProperty("sentry.logs.enabled")) {
199-
final boolean enableLogs =
200-
Boolean.TRUE.equals(environment.getProperty("sentry.logs.enabled", Boolean.class));
201-
if (enableLogs) {
202-
options
203-
.getLogger()
204-
.log(
205-
SentryLevel.WARNING,
206-
"The 'sentry.logs.enabled' property is no longer supported. Manual "
207-
+ "Sentry.logger() calls no longer require it, and automatic logging "
208-
+ "integrations now require their own opt-ins.");
209-
} else {
210-
options
211-
.getLogger()
212-
.log(
213-
SentryLevel.WARNING,
214-
"The 'sentry.logs.enabled' property no longer disables manual Sentry.logger() "
215-
+ "calls. Automatic logging integrations remain disabled unless enabled "
216-
+ "through their own opt-ins.");
217-
}
218-
}
219-
}
220-
221193
@Configuration(proxyBeanMethods = false)
222194
@ConditionalOnClass(MDC.class)
223195
@Open

‎sentry-spring-boot-jakarta/src/test/kotlin/io/sentry/spring/boot/jakarta/SentryAutoConfigurationTest.kt‎

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import io.sentry.EventProcessor
99
import io.sentry.FilterString
1010
import io.sentry.Hint
1111
import io.sentry.IContinuousProfiler
12-
import io.sentry.ILogger
1312
import io.sentry.IProfileConverter
1413
import io.sentry.IScopes
1514
import io.sentry.ITransportFactory
@@ -61,9 +60,7 @@ import org.assertj.core.api.Assertions.assertThat
6160
import org.mockito.internal.util.MockUtil.isMock
6261
import org.mockito.kotlin.any
6362
import org.mockito.kotlin.anyOrNull
64-
import org.mockito.kotlin.eq
6563
import org.mockito.kotlin.mock
66-
import org.mockito.kotlin.never
6764
import org.mockito.kotlin.verify
6865
import org.mockito.kotlin.whenever
6966
import org.quartz.JobExecutionContext
@@ -201,56 +198,6 @@ class SentryAutoConfigurationTest {
201198
}
202199
}
203200

204-
@Test
205-
fun `legacy logs property emits no warning when absent`() {
206-
val logger = mock<ILogger>()
207-
dsnEnabledRunner
208-
.withPropertyValues("sentry.debug=true")
209-
.withBean(ILogger::class.java, { logger })
210-
.withUserConfiguration(LoggerConfiguration::class.java)
211-
.run { verify(logger, never()).log(eq(SentryLevel.WARNING), any<String>()) }
212-
}
213-
214-
@Test
215-
fun `legacy logs property true emits migration warning`() {
216-
val logger = mock<ILogger>()
217-
dsnEnabledRunner
218-
.withPropertyValues("sentry.debug=true", "sentry.logs.enabled=true")
219-
.withBean(ILogger::class.java, { logger })
220-
.withUserConfiguration(LoggerConfiguration::class.java)
221-
.run {
222-
verify(logger)
223-
.log(
224-
SentryLevel.WARNING,
225-
"The 'sentry.logs.enabled' property is no longer supported. Manual " +
226-
"Sentry.logger() calls no longer require it, and automatic logging " +
227-
"integrations now require their own opt-ins.",
228-
*emptyArray(),
229-
)
230-
assertThat(it.getBean(SentryProperties::class.java).logging.isEnableLogs).isFalse()
231-
}
232-
}
233-
234-
@Test
235-
fun `legacy logs property false emits migration warning`() {
236-
val logger = mock<ILogger>()
237-
dsnEnabledRunner
238-
.withPropertyValues("sentry.debug=true", "sentry.logs.enabled=false")
239-
.withBean(ILogger::class.java, { logger })
240-
.withUserConfiguration(LoggerConfiguration::class.java)
241-
.run {
242-
verify(logger)
243-
.log(
244-
SentryLevel.WARNING,
245-
"The 'sentry.logs.enabled' property no longer disables manual Sentry.logger() " +
246-
"calls. Automatic logging integrations remain disabled unless enabled through " +
247-
"their own opt-ins.",
248-
*emptyArray(),
249-
)
250-
assertThat(it.getBean(SentryProperties::class.java).logging.isEnableLogs).isFalse()
251-
}
252-
}
253-
254201
@Test
255202
fun `properties are applied to SentryOptions`() {
256203
contextRunner
@@ -1361,13 +1308,6 @@ class SentryAutoConfigurationTest {
13611308
@Bean open fun sentryTransport() = transport
13621309
}
13631310

1364-
@Configuration(proxyBeanMethods = false)
1365-
open class LoggerConfiguration {
1366-
@Bean
1367-
open fun loggerConfiguration(logger: ILogger) =
1368-
Sentry.OptionsConfiguration<SentryOptions> { it.setLogger(logger) }
1369-
}
1370-
13711311
@Configuration(proxyBeanMethods = false)
13721312
open class NoOpTransportConfiguration {
13731313

0 commit comments

Comments
 (0)