Skip to content

Commit 1b587af

Browse files
authored
fix: include exceptions in logging from trace probes (#785)
1 parent 44037b9 commit 1b587af

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "6ef995dd-8bce-411f-84df-7790179d5ffa",
3+
"type": "bugfix",
4+
"description": "Include exceptions in logging from trace probes",
5+
"issues": [
6+
"awslabs/smithy-kotlin#784"
7+
]
8+
}

runtime/tracing/tracing-core/common/src/aws/smithy/kotlin/runtime/tracing/LoggingTraceProbe.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ public object LoggingTraceProbe : TraceProbe {
2626
val logger = KotlinLogging.logger(event.sourceComponent)
2727
val method = event.level.loggerMethod()
2828
method(logger) {
29-
val msg = (event.data as TraceEventData.Message).content()
30-
"$spanId: $msg"
29+
val message = event.data as TraceEventData.Message
30+
31+
val content = message.content()
32+
val exception = message.exception?.let { ": $it" } ?: ""
33+
34+
"$spanId: $content$exception"
3135
}
3236
}
3337

0 commit comments

Comments
 (0)