Skip to content

Commit ea7b9c1

Browse files
Log parameter objects are now turned into String via toString (#4515)
* Add user id, username and email to log attributes * wip * Check log event count before sending envelope * changelog * Min event level config option; enable logs in logback sample * review feedback * treat unformatted message and params as pii if logback encoder is present * Use toString for turning log param objects into strings * Format code * changelog --------- Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
1 parent b93e18d commit ea7b9c1

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
- No longer send out empty log envelopes ([#4497](https://github.com/getsentry/sentry-java/pull/4497))
1212
- Session Replay: Expand fix for crash on devices to all Unisoc/Spreadtrum chipsets ([#4510](https://github.com/getsentry/sentry-java/pull/4510))
13+
- Log parameter objects are now turned into `String` via `toString` ([#4515](https://github.com/getsentry/sentry-java/pull/4515))
14+
- One of the two `SentryLogEventAttributeValue` constructors did not convert the value previously.
1315

1416
### Features
1517

@@ -29,7 +31,7 @@
2931
<minimumEventLevel>WARN</minimumEventLevel>
3032
<!-- Default for Breadcrumbs is INFO -->
3133
<minimumBreadcrumbLevel>DEBUG</minimumBreadcrumbLevel>
32-
<!-- Default for Breadcrumbs is INFO -->
34+
<!-- Default for Log Events is INFO -->
3335
<minimumLevel>INFO</minimumLevel>
3436
</appender>
3537
```

sentry/src/main/java/io/sentry/SentryLogEventAttributeValue.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public SentryLogEventAttributeValue(final @NotNull String type, final @Nullable
2424

2525
public SentryLogEventAttributeValue(
2626
final @NotNull SentryAttributeType type, final @Nullable Object value) {
27-
this.type = type.apiName();
28-
this.value = value;
27+
this(type.apiName(), value);
2928
}
3029

3130
public @NotNull String getType() {

sentry/src/test/java/io/sentry/protocol/SentryLogsSerializationTest.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.sentry.ILogger
66
import io.sentry.JsonObjectReader
77
import io.sentry.JsonObjectWriter
88
import io.sentry.JsonSerializable
9+
import io.sentry.SentryAttributeType
910
import io.sentry.SentryLogEvent
1011
import io.sentry.SentryLogEventAttributeValue
1112
import io.sentry.SentryLogEvents
@@ -39,6 +40,8 @@ class SentryLogsSerializationTest {
3940
"sentry.trace.parent_span_id" to
4041
SentryLogEventAttributeValue("string", "f28b86350e534671"),
4142
"custom.boolean" to SentryLogEventAttributeValue("boolean", true),
43+
"custom.point2" to
44+
SentryLogEventAttributeValue(SentryAttributeType.STRING, Point(21, 31)),
4245
"custom.double" to SentryLogEventAttributeValue("double", 11.12.toDouble()),
4346
"custom.point" to SentryLogEventAttributeValue("string", Point(20, 30)),
4447
"custom.integer" to SentryLogEventAttributeValue("integer", 10),

sentry/src/test/resources/json/sentry_logs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
"type": "boolean",
3535
"value": true
3636
},
37+
"custom.point2": {
38+
"type": "string",
39+
"value": "Point{x:21,y:31}-Hello"
40+
},
3741
"custom.double": {
3842
"type": "double",
3943
"value": 11.12

0 commit comments

Comments
 (0)
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