You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/logging.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -640,7 +640,7 @@ To append additional keys in your logs, you can use the `StructuredArguments` cl
640
640
}
641
641
```
642
642
643
-
???+ warning "Warning"
643
+
???+ warning "Do not use arguments with reserved keys"
644
644
If the key name of your structured argument matches any of the [standard structured keys](#standard-structured-keys) or any of the [additional structured keys](#additional-structured-keys) the whole argument will be ignored. This is to protect you from accidentally overwriting reserved keys such as the log level or Lambda context information.
645
645
646
646
**Using MDC**
@@ -653,6 +653,9 @@ Mapped Diagnostic Context (MDC) is essentially a Key-Value store. It is supporte
653
653
???+ warning "Custom keys stored in the MDC are persisted across warm invocations"
654
654
Always set additional keys as part of your handler method to ensure they have the latest value, or explicitly clear them with [`clearState=true`](#clearing-state).
655
655
656
+
???+ warning "Do not add reserved keys to MDC"
657
+
Avoid adding any of the keys listed in [standard structured keys](#standard-structured-keys) and [additional structured keys](#additional-structured-keys) to your MDC. This may cause unindented behavior and will overwrite the context set by Powertools. Unlike with StructuredArguments, Powertools will **not** ignore reserved keys set via MDC.
0 commit comments