From 0cc3de457c3d4f3bc197a04621e8b5718745c350 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 12 Jun 2025 11:41:58 +0200 Subject: [PATCH 01/10] Add user id, username and email to log attributes --- .../main/java/io/sentry/logger/LoggerApi.java | 23 +++++++ .../main/java/io/sentry/protocol/User.java | 10 ++- sentry/src/test/java/io/sentry/ScopesTest.kt | 63 +++++++++++++++++++ 3 files changed, 94 insertions(+), 2 deletions(-) diff --git a/sentry/src/main/java/io/sentry/logger/LoggerApi.java b/sentry/src/main/java/io/sentry/logger/LoggerApi.java index 71eccb4840..6a904e96c3 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerApi.java @@ -17,6 +17,7 @@ import io.sentry.SpanId; import io.sentry.protocol.SdkVersion; import io.sentry.protocol.SentryId; +import io.sentry.protocol.User; import io.sentry.util.Platform; import io.sentry.util.TracingUtils; import java.util.HashMap; @@ -213,6 +214,10 @@ private void captureLog( setServerName(attributes); } + if (scopes.getOptions().isSendDefaultPii()) { + setUser(attributes); + } + return attributes; } @@ -231,6 +236,24 @@ private void setServerName( } } + private void setUser(final @NotNull HashMap attributes) { + final @Nullable User user = scopes.getCombinedScopeView().getUser(); + if (user != null) { + final @Nullable String id = user.getId(); + if (id != null) { + attributes.put("user.id", new SentryLogEventAttributeValue("string", id)); + } + final @Nullable String username = user.getUsername(); + if (username != null) { + attributes.put("user.name", new SentryLogEventAttributeValue("string", username)); + } + final @Nullable String email = user.getEmail(); + if (email != null) { + attributes.put("user.email", new SentryLogEventAttributeValue("string", email)); + } + } + } + private @NotNull SentryAttributeType getType(final @Nullable Object arg) { if (arg instanceof Boolean) { return SentryAttributeType.BOOLEAN; diff --git a/sentry/src/main/java/io/sentry/protocol/User.java b/sentry/src/main/java/io/sentry/protocol/User.java index e19525eefc..0035f85c21 100644 --- a/sentry/src/main/java/io/sentry/protocol/User.java +++ b/sentry/src/main/java/io/sentry/protocol/User.java @@ -37,8 +37,10 @@ public final class User implements JsonUnknown, JsonSerializable { /** Remote IP address of the user. */ private @Nullable String ipAddress; - /** Human readable name. */ - private @Nullable String name; + /** + * @deprecated please use {@link User#username} Human readable name. + */ + @Deprecated private @Nullable String name; /** User geo location. */ private @Nullable Geo geo; @@ -215,7 +217,9 @@ public void setIpAddress(final @Nullable String ipAddress) { * Get human readable name. * * @return Human readable name + * @deprecated please use {@link User#getUsername()} */ + @Deprecated public @Nullable String getName() { return name; } @@ -224,7 +228,9 @@ public void setIpAddress(final @Nullable String ipAddress) { * Set human readable name. * * @param name Human readable name + * @deprecated please use {@link User#setUsername(String)} */ + @Deprecated public void setName(final @Nullable String name) { this.name = name; } diff --git a/sentry/src/test/java/io/sentry/ScopesTest.kt b/sentry/src/test/java/io/sentry/ScopesTest.kt index 49a9500216..f0dec629de 100644 --- a/sentry/src/test/java/io/sentry/ScopesTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesTest.kt @@ -2851,6 +2851,69 @@ class ScopesTest { ) } + @Test + fun `adds user fields to log attributes if sendDefaultPii is true`() { + val (sut, mockClient) = getEnabledScopes { + it.logs.isEnabled = true + it.isSendDefaultPii = true + } + + sut.configureScope { scope -> + scope.user = User().also { + it.id = "usrid" + it.username = "usrname" + it.email = "user@sentry.io" + } + } + sut.logger().log(SentryLogLevel.WARN, "log message") + + verify(mockClient).captureLog( + check { + assertEquals("log message", it.body) + + val userId = it.attributes?.get("user.id")!! + assertEquals("usrid", userId.value) + assertEquals("string", userId.type) + + val userName = it.attributes?.get("user.name")!! + assertEquals("usrname", userName.value) + assertEquals("string", userName.type) + + val userEmail = it.attributes?.get("user.email")!! + assertEquals("user@sentry.io", userEmail.value) + assertEquals("string", userEmail.type) + }, + anyOrNull() + ) + } + + @Test + fun `does not add user fields to log attributes by default`() { + val (sut, mockClient) = getEnabledScopes { + it.logs.isEnabled = true + } + + sut.configureScope { scope -> + scope.user = User().also { + it.id = "usrid" + it.username = "usrname" + it.email = "user@sentry.io" + } + } + sut.logger().log(SentryLogLevel.WARN, "log message") + + verify(mockClient).captureLog( + check { + assertEquals("log message", it.body) + + assertNull(it.attributes?.get("user.id")) + assertNull(it.attributes?.get("user.name")) + assertNull(it.attributes?.get("user.email")) + }, + anyOrNull() + ) + } + //endregion @Test From cb1ebc81044e24bca0186cd6970af9bbcd570206 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 17 Jun 2025 09:11:42 +0200 Subject: [PATCH 02/10] wip --- sentry-logback/api/sentry-logback.api | 1 + .../io/sentry/logback/SentryAppender.java | 48 +++++++++++++++++++ sentry/src/test/java/io/sentry/ScopesTest.kt | 45 +++++++++++++++++ 3 files changed, 94 insertions(+) diff --git a/sentry-logback/api/sentry-logback.api b/sentry-logback/api/sentry-logback.api index 256e931e2a..642d104bb6 100644 --- a/sentry-logback/api/sentry-logback.api +++ b/sentry-logback/api/sentry-logback.api @@ -8,6 +8,7 @@ public class io/sentry/logback/SentryAppender : ch/qos/logback/core/Unsynchroniz public fun ()V protected fun append (Lch/qos/logback/classic/spi/ILoggingEvent;)V protected synthetic fun append (Ljava/lang/Object;)V + protected fun captureLog (Lch/qos/logback/classic/spi/ILoggingEvent;)V protected fun createBreadcrumb (Lch/qos/logback/classic/spi/ILoggingEvent;)Lio/sentry/Breadcrumb; protected fun createEvent (Lch/qos/logback/classic/spi/ILoggingEvent;)Lio/sentry/SentryEvent; public fun getMinimumBreadcrumbLevel ()Lch/qos/logback/classic/Level; 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 7e96892d57..6810833311 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -19,6 +19,7 @@ import io.sentry.SentryEvent; import io.sentry.SentryIntegrationPackageStorage; import io.sentry.SentryLevel; +import io.sentry.SentryLogLevel; import io.sentry.SentryOptions; import io.sentry.exception.ExceptionMechanismException; import io.sentry.protocol.Mechanism; @@ -46,6 +47,7 @@ public class SentryAppender extends UnsynchronizedAppenderBase { private @Nullable ITransportFactory transportFactory; private @NotNull Level minimumBreadcrumbLevel = Level.INFO; private @NotNull Level minimumEventLevel = Level.ERROR; + private @NotNull Level minimumLevel = Level.INFO; private @Nullable Encoder encoder; static { @@ -78,6 +80,12 @@ public void start() { @Override protected void append(@NotNull ILoggingEvent eventObject) { + if (eventObject.getLevel().isGreaterOrEqual(minimumLevel)) { + final Hint hint = new Hint(); + hint.set(SENTRY_SYNTHETIC_EXCEPTION, eventObject); + + captureLog(eventObject); + } if (eventObject.getLevel().isGreaterOrEqual(minimumEventLevel)) { final Hint hint = new Hint(); hint.set(SENTRY_SYNTHETIC_EXCEPTION, eventObject); @@ -162,6 +170,26 @@ protected void append(@NotNull ILoggingEvent eventObject) { return event; } + /** + * Captures a Sentry log from Logback's {@link ILoggingEvent}. + * + * @param loggingEvent the logback event + */ + // for the Android compatibility we must use old Java Date class + @SuppressWarnings("JdkObsolete") + protected void captureLog(@NotNull ILoggingEvent loggingEvent) { + final @NotNull SentryLogLevel sentryLevel = toSentryLogLevel(loggingEvent.getLevel()); + + // // if encoder is set we treat message+params as PII as encoders may be used to mask/strip + // PII + // if (encoder == null || options.isSendDefaultPii()) { + // message.setMessage(loggingEvent.getMessage()); + // message.setParams(toParams(loggingEvent.getArgumentArray())); + // } + + Sentry.logger().log(sentryLevel, formatted(loggingEvent), loggingEvent.getArgumentArray()); + } + private String formatted(@NotNull ILoggingEvent loggingEvent) { if (encoder != null) { try { @@ -218,6 +246,26 @@ private String formatted(@NotNull ILoggingEvent loggingEvent) { } } + /** + * Transforms a {@link Level} into an {@link SentryLogLevel}. + * + * @param level original level as defined in log4j. + * @return log level used within sentry. + */ + private static @NotNull SentryLogLevel toSentryLogLevel(@NotNull Level level) { + if (level.isGreaterOrEqual(Level.ERROR)) { + return SentryLogLevel.ERROR; + } else if (level.isGreaterOrEqual(Level.WARN)) { + return SentryLogLevel.WARN; + } else if (level.isGreaterOrEqual(Level.INFO)) { + return SentryLogLevel.INFO; + } else if (level.isGreaterOrEqual(Level.DEBUG)) { + return SentryLogLevel.DEBUG; + } else { + return SentryLogLevel.TRACE; + } + } + private @NotNull SdkVersion createSdkVersion(@NotNull SentryOptions sentryOptions) { SdkVersion sdkVersion = sentryOptions.getSdkVersion(); diff --git a/sentry/src/test/java/io/sentry/ScopesTest.kt b/sentry/src/test/java/io/sentry/ScopesTest.kt index f0dec629de..9be7aeca8b 100644 --- a/sentry/src/test/java/io/sentry/ScopesTest.kt +++ b/sentry/src/test/java/io/sentry/ScopesTest.kt @@ -2887,6 +2887,51 @@ class ScopesTest { ) } + @Test + fun `missing user does not break attributes`() { + val (sut, mockClient) = getEnabledScopes { + it.logs.isEnabled = true + it.isSendDefaultPii = true + } + + sut.logger().log(SentryLogLevel.WARN, "log message") + + verify(mockClient).captureLog( + check { + assertEquals("log message", it.body) + + assertNull(it.attributes?.get("user.id")) + assertNull(it.attributes?.get("user.name")) + assertNull(it.attributes?.get("user.email")) + }, + anyOrNull() + ) + } + + @Test + fun `missing user fields do not break attributes`() { + val (sut, mockClient) = getEnabledScopes { + it.logs.isEnabled = true + it.isSendDefaultPii = true + } + + sut.configureScope { scope -> + scope.user = User() + } + sut.logger().log(SentryLogLevel.WARN, "log message") + + verify(mockClient).captureLog( + check { + assertEquals("log message", it.body) + + assertNull(it.attributes?.get("user.id")) + assertNull(it.attributes?.get("user.name")) + assertNull(it.attributes?.get("user.email")) + }, + anyOrNull() + ) + } + @Test fun `does not add user fields to log attributes by default`() { val (sut, mockClient) = getEnabledScopes { From be3965454d1bf8c1a02cfd984145bb3a1141cd57 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 18 Jun 2025 15:40:18 +0200 Subject: [PATCH 03/10] Check log event count before sending envelope --- .../src/main/java/io/sentry/logger/LoggerBatchProcessor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java index e83ab6d73d..08532b64ef 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerBatchProcessor.java @@ -101,7 +101,9 @@ private void flushBatch() { } } while (!queue.isEmpty() && logEvents.size() < MAX_BATCH_SIZE); - client.captureBatchedLogEvents(new SentryLogEvents(logEvents)); + if (!logEvents.isEmpty()) { + client.captureBatchedLogEvents(new SentryLogEvents(logEvents)); + } } private class BatchRunnable implements Runnable { From 44512db89429ebc28e111f841cecbb9bf41f0ea9 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Wed, 18 Jun 2025 15:44:50 +0200 Subject: [PATCH 04/10] changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe4c599b6f..f8bd65da81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- No longer send out empty log envelopes ([#4497](https://github.com/getsentry/sentry-java/pull/4497)) + ## 8.14.0 ### Fixes From fb24e9c93efc8dbd2bae4ebf562ef2dde144eb4e Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 20 Jun 2025 07:20:39 +0200 Subject: [PATCH 05/10] Min event level config option; enable logs in logback sample --- sentry-logback/api/sentry-logback.api | 2 ++ .../main/java/io/sentry/logback/SentryAppender.java | 10 ++++++++++ .../src/main/resources/logback.xml | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/sentry-logback/api/sentry-logback.api b/sentry-logback/api/sentry-logback.api index 642d104bb6..84a3c90d5c 100644 --- a/sentry-logback/api/sentry-logback.api +++ b/sentry-logback/api/sentry-logback.api @@ -13,9 +13,11 @@ public class io/sentry/logback/SentryAppender : ch/qos/logback/core/Unsynchroniz protected fun createEvent (Lch/qos/logback/classic/spi/ILoggingEvent;)Lio/sentry/SentryEvent; public fun getMinimumBreadcrumbLevel ()Lch/qos/logback/classic/Level; public fun getMinimumEventLevel ()Lch/qos/logback/classic/Level; + public fun getMinimumLevel ()Lch/qos/logback/classic/Level; public fun setEncoder (Lch/qos/logback/core/encoder/Encoder;)V public fun setMinimumBreadcrumbLevel (Lch/qos/logback/classic/Level;)V public fun setMinimumEventLevel (Lch/qos/logback/classic/Level;)V + public fun setMinimumLevel (Lch/qos/logback/classic/Level;)V public fun setOptions (Lio/sentry/SentryOptions;)V public fun start ()V } 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 6810833311..7312dcc385 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -306,6 +306,16 @@ public void setMinimumEventLevel(final @Nullable Level minimumEventLevel) { return minimumEventLevel; } + public void setMinimumLevel(final @Nullable Level minimumLevel) { + if (minimumLevel != null) { + this.minimumLevel = minimumLevel; + } + } + + public @NotNull Level getMinimumLevel() { + return minimumLevel; + } + @ApiStatus.Internal void setTransportFactory(final @Nullable ITransportFactory transportFactory) { this.transportFactory = transportFactory; 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 02bee862a3..8082af4483 100644 --- a/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml +++ b/sentry-samples/sentry-samples-logback/src/main/resources/logback.xml @@ -13,12 +13,17 @@ https://502f25099c204a2fbf4cb16edc5975d1@o447951.ingest.sentry.io/5428563 userId requestId + + true + WARN DEBUG + + INFO From 7792597409ccb60e829c0fdc86657db1f829b79a Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Fri, 20 Jun 2025 15:08:04 +0200 Subject: [PATCH 06/10] review feedback --- .../src/main/java/io/sentry/logback/SentryAppender.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 7312dcc385..67aa415cc1 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -80,10 +80,7 @@ public void start() { @Override protected void append(@NotNull ILoggingEvent eventObject) { - if (eventObject.getLevel().isGreaterOrEqual(minimumLevel)) { - final Hint hint = new Hint(); - hint.set(SENTRY_SYNTHETIC_EXCEPTION, eventObject); - + if (options.getLogs().isEnabled() && eventObject.getLevel().isGreaterOrEqual(minimumLevel)) { captureLog(eventObject); } if (eventObject.getLevel().isGreaterOrEqual(minimumEventLevel)) { From d9c2a15799965f2d493de0bfdeee65f27f800380 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Mon, 23 Jun 2025 12:19:29 +0200 Subject: [PATCH 07/10] treat unformatted message and params as pii if logback encoder is present --- .../io/sentry/logback/SentryAppender.java | 23 +++++++++++++------ .../main/java/io/sentry/logger/LoggerApi.java | 8 ++++--- 2 files changed, 21 insertions(+), 10 deletions(-) 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 67aa415cc1..dfc2465571 100644 --- a/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java +++ b/sentry-logback/src/main/java/io/sentry/logback/SentryAppender.java @@ -16,12 +16,15 @@ import io.sentry.InitPriority; import io.sentry.ScopesAdapter; import io.sentry.Sentry; +import io.sentry.SentryAttribute; +import io.sentry.SentryAttributes; import io.sentry.SentryEvent; import io.sentry.SentryIntegrationPackageStorage; import io.sentry.SentryLevel; import io.sentry.SentryLogLevel; import io.sentry.SentryOptions; import io.sentry.exception.ExceptionMechanismException; +import io.sentry.logger.SentryLogParameters; import io.sentry.protocol.Mechanism; import io.sentry.protocol.Message; import io.sentry.protocol.SdkVersion; @@ -177,14 +180,20 @@ protected void append(@NotNull ILoggingEvent eventObject) { protected void captureLog(@NotNull ILoggingEvent loggingEvent) { final @NotNull SentryLogLevel sentryLevel = toSentryLogLevel(loggingEvent.getLevel()); - // // if encoder is set we treat message+params as PII as encoders may be used to mask/strip - // PII - // if (encoder == null || options.isSendDefaultPii()) { - // message.setMessage(loggingEvent.getMessage()); - // message.setParams(toParams(loggingEvent.getArgumentArray())); - // } + @Nullable Object[] arguments = null; + final @NotNull SentryAttributes attributes = SentryAttributes.of(); - Sentry.logger().log(sentryLevel, formatted(loggingEvent), loggingEvent.getArgumentArray()); + // if encoder is set we treat message+params as PII as encoders may be used to mask/strip PII + if (encoder == null || options.isSendDefaultPii()) { + attributes.add( + SentryAttribute.stringAttribute("sentry.message.template", loggingEvent.getMessage())); + arguments = loggingEvent.getArgumentArray(); + } + + final @NotNull String formattedMessage = formatted(loggingEvent); + final @NotNull SentryLogParameters params = SentryLogParameters.create(attributes); + + Sentry.logger().log(sentryLevel, params, formattedMessage, arguments); } private String formatted(@NotNull ILoggingEvent loggingEvent) { diff --git a/sentry/src/main/java/io/sentry/logger/LoggerApi.java b/sentry/src/main/java/io/sentry/logger/LoggerApi.java index 1e8fef75a8..976b55de6e 100644 --- a/sentry/src/main/java/io/sentry/logger/LoggerApi.java +++ b/sentry/src/main/java/io/sentry/logger/LoggerApi.java @@ -184,9 +184,11 @@ private void captureLog( i++; } if (i > 0) { - attributes.put( - "sentry.message.template", - new SentryLogEventAttributeValue(SentryAttributeType.STRING, message)); + if (attributes.get("sentry.message.template") == null) { + attributes.put( + "sentry.message.template", + new SentryLogEventAttributeValue(SentryAttributeType.STRING, message)); + } } } From 6938f6d13db7fe32cc0a873b179defe812bc4322 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 24 Jun 2025 12:05:01 +0200 Subject: [PATCH 08/10] Use toString for turning log param objects into strings --- .../src/main/java/io/sentry/SentryLogEventAttributeValue.java | 3 +-- .../java/io/sentry/protocol/SentryLogsSerializationTest.kt | 2 ++ sentry/src/test/resources/json/sentry_logs.json | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java index e45c79564f..5be45b29e5 100644 --- a/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java +++ b/sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java @@ -24,8 +24,7 @@ public SentryLogEventAttributeValue(final @NotNull String type, final @Nullable public SentryLogEventAttributeValue( final @NotNull SentryAttributeType type, final @Nullable Object value) { - this.type = type.apiName(); - this.value = value; + this(type.apiName(), value); } public @NotNull String getType() { diff --git a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt index e7d71f2a36..bfc601a482 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt @@ -6,6 +6,7 @@ import io.sentry.ILogger import io.sentry.JsonObjectReader import io.sentry.JsonObjectWriter import io.sentry.JsonSerializable +import io.sentry.SentryAttributeType import io.sentry.SentryLogEvent import io.sentry.SentryLogEventAttributeValue import io.sentry.SentryLogEvents @@ -39,6 +40,7 @@ class SentryLogsSerializationTest { "sentry.trace.parent_span_id" to SentryLogEventAttributeValue("string", "f28b86350e534671"), "custom.boolean" to SentryLogEventAttributeValue("boolean", true), + "custom.point2" to SentryLogEventAttributeValue(SentryAttributeType.STRING, Point(21, 31)), "custom.double" to SentryLogEventAttributeValue("double", 11.12.toDouble()), "custom.point" to SentryLogEventAttributeValue("string", Point(20, 30)), "custom.integer" to SentryLogEventAttributeValue("integer", 10), diff --git a/sentry/src/test/resources/json/sentry_logs.json b/sentry/src/test/resources/json/sentry_logs.json index 7040012c29..67ced8b7cc 100644 --- a/sentry/src/test/resources/json/sentry_logs.json +++ b/sentry/src/test/resources/json/sentry_logs.json @@ -34,6 +34,10 @@ "type": "boolean", "value": true }, + "custom.point2": { + "type": "string", + "value": "Point{x:21,y:31}-Hello" + }, "custom.double": { "type": "double", "value": 11.12 From 1dc98dca17b35f8e301547f97f16ecac787e6a16 Mon Sep 17 00:00:00 2001 From: Sentry Github Bot Date: Tue, 24 Jun 2025 10:19:39 +0000 Subject: [PATCH 09/10] Format code --- .../java/io/sentry/protocol/SentryLogsSerializationTest.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt index bfc601a482..1d72f6342d 100644 --- a/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt +++ b/sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt @@ -40,7 +40,8 @@ class SentryLogsSerializationTest { "sentry.trace.parent_span_id" to SentryLogEventAttributeValue("string", "f28b86350e534671"), "custom.boolean" to SentryLogEventAttributeValue("boolean", true), - "custom.point2" to SentryLogEventAttributeValue(SentryAttributeType.STRING, Point(21, 31)), + "custom.point2" to + SentryLogEventAttributeValue(SentryAttributeType.STRING, Point(21, 31)), "custom.double" to SentryLogEventAttributeValue("double", 11.12.toDouble()), "custom.point" to SentryLogEventAttributeValue("string", Point(20, 30)), "custom.integer" to SentryLogEventAttributeValue("integer", 10), From 897b6b1e6b5d4989df6754a64ca6d310dd9f2810 Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Tue, 24 Jun 2025 14:58:05 +0200 Subject: [PATCH 10/10] changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1c4a796c0..681e1ba8af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - No longer send out empty log envelopes ([#4497](https://github.com/getsentry/sentry-java/pull/4497)) - Session Replay: Expand fix for crash on devices to all Unisoc/Spreadtrum chipsets ([#4510](https://github.com/getsentry/sentry-java/pull/4510)) +- Log parameter objects are now turned into `String` via `toString` ([#4515](https://github.com/getsentry/sentry-java/pull/4515)) + - One of the two `SentryLogEventAttributeValue` constructors did not convert the value previously. ### Features @@ -29,7 +31,7 @@ WARN DEBUG - + INFO ``` pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy