Skip to content

Commit 598f64b

Browse files
committed
Paraphrasing
1 parent 899d7e6 commit 598f64b

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

docs/adrs/006-logging-strategy.md

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,41 @@
22

33
## Status
44

5-
Proposed
5+
Accepted
66

77
## Context
88

99
The AI SDK identified some challenges with debugging and problem resolution that can be addressed with better logging.
10-
Typically, users had to enable wire logs to access information necessary for troubleshooting which, along with helpful logs, surfaces a large volume of unrelated ones.
11-
Additionally, we identified the need to improve visibility into what's happening behind the scenes about application progress to the user.
10+
Typically, users have to enable wire logs for troubleshooting which, along with helpful logs, surfaces a large volume of unrelated ones.
11+
Additionally, we identified the need to improve visibility into application progress to the user.
1212

13-
Key challenges that drove this decision:
13+
Key drivers for this decision include:
1414

15-
- **Debugging difficulties**: Limited visibility into request flows and processing steps
16-
- **Security concerns**: Risk of accidentally logging sensitive information
17-
- **User experience**: Users needed better insight into long-running AI operations
18-
- **Trace ownership**: Reliance on external parties for troubleshooting details
15+
- **Debugging difficulties**: Limited visibility into request flows.
16+
- **Security risks**: Accidental logging of sensitive data.
17+
- **Poor user experience**: Lack of insight into application progress.
18+
- **Troubleshooting dependency**: Reliance on external parties for critical details.
1919

2020
## Decision
2121

22-
Devise and follow comprehensive logging guidelines that prioritize **debugging capability** and **user visibility** while maintaining **security** and **performance**.
23-
The approach emphasizes descriptive, human-readable logs with structured request tracking through MDC (Mapped Diagnostic Context).
22+
We will implement and enforce comprehensive logging guidelines that prioritize **debugging capability** and **user visibility**.
23+
This approach mandates descriptive, human-readable logs with structured request tracking through Mapped Diagnostic Context (MDC).
2424

2525
## Guidelines
2626

27-
### 1. Content and Security
27+
### 1. Log Content and Security
2828

29-
* **Avoid sensitive information.**
30-
As a general rule, avoid logging full request or response bodies.
31-
Do not log any personally identifiable or confidential data such as names, IDs, tokens, or payload content.
29+
- **Do not log sensitive information.**
30+
Never log full request or response bodies.
31+
Ensure that personally identifiable or confidential datasuch as names, IDs, tokens, or payload content—is always excluded from logs.
3232

33-
* **Keep logs concise and relevant.**
34-
Every log should convey meaningful information without redundancy.
35-
Avoid verbose, repetitive, or cosmetic details.
33+
- **Write concise and relevant logs.**
34+
Every log must convey meaningful information.
35+
Avoid verbose, repetitive, or purely cosmetic details.
3636

37-
* **Use descriptive, human-readable formats.**
38-
Logs should read naturally and provide enough context for a developer to understand what happened without consulting the code.
39-
While descriptiveness is a priority, follow the `metric=value` pattern where practical to include additional details with extensibility in mind.
40-
Check out the example below.
37+
- **Use descriptive, human-readable formats.**
38+
Logs must be clear enough for a developer to understand what happened without checking the code.
39+
Use the `metric=value` pattern to include structured details with extensibility in mind.
4140

4241
```[reqId=e3eaa45c] OpenAI request completed successfully with duration=1628ms, size=1,2KB.```
4342

@@ -56,10 +55,10 @@ The approach emphasizes descriptive, human-readable logs with structured request
5655
Keep per-request logs **below INFO level** (e.g., DEBUG or TRACE) to prevent cluttering normal application output.
5756

5857
* **Application runtime logs.**
59-
Prefer **INFO level** for one-time or startup/shutdown logs that occur once per application run.
58+
Prefer **INFO level** only for one-time or startup/shutdown logs that occur once per application run.
6059

6160
* **Avoid unnecessary warnings.**
62-
Use the WARNING level only for actionable or genuinely concerning conditions.
61+
Use the WARN level only for actionable or genuinely concerning conditions.
6362
Do not use it as a placeholder or for expected transient states.
6463

6564
* **Explicit request logging.**
@@ -69,7 +68,7 @@ The approach emphasizes descriptive, human-readable logs with structured request
6968
This approach also avoids the need for stack-trace investigation when surface error responses are ambiguous.
7069

7170
* **Performance-aware logging.**
72-
If a log statement requires computation or inference to generate information, guard it with a log-level check (e.g., `if (log.isDebugEnabled())`) or other available context to avoid unnecessary overhead.
71+
If a log statement requires expensive computation, guard it with a log-level check (e.g., `if (log.isDebugEnabled())`) to prevent performance degradation.
7372

7473
---
7574

@@ -89,7 +88,7 @@ The approach emphasizes descriptive, human-readable logs with structured request
8988

9089
* **Centralized MDC management.**
9190
Avoid using magic strings for MDC keys or values.
92-
Define them in a dedicated structure or utility (e.g., `RequestlogContext` class) to ensure discoverability and prevent errors during refactoring.
91+
Define them in a dedicated structure or utility (e.g., `RequestLogContext` class) to ensure discoverability and prevent errors during refactoring.
9392

9493
* **Responsibility and ownership.**
9594
The component or class that sets MDC context values is also responsible for clearing them.

0 commit comments

Comments
 (0)