fix: replace printStackTrace with RecordLog in ConfigUtil - #3638
Conversation
BitDive Runtime Review - PR #3638PR: #3638 SummaryThis PR replaces 3 The actual changed catch blocks are structurally untestable in this environment: they are private static methods not reachable from any HTTP endpoint, and the unit test does not inject failures. A code-level finding worth noting: Runtime Verification Matrix
How to read BitDive evidenceBehavior Δ in the matrix and the red/green
GitHub strips Review scope and validation coverage
Not covered at runtime: The 3 changed catch blocks are private static methods called during JVM static initialization, not reachable from any HTTP endpoint. The unit test does not inject failures, so the Change #1 - ConfigUtil logging migration (stable at runtime)Replaces 3 Behavior contract# ConfigUtil logging migration — runtime contract (both traced endpoints)
HTTP 200 → 200 (identical response bodies)
SQL: none on either path
writes: none
downstream REST: none
steps: 1 → 1 (single-node execution trees)
# first divergence: NONE — CLEAN baseline on both trace pairs
# circular dependency risk: NOT REPRODUCED — head JVM starts and serves normallyScenario matrix
Trace evidence
Contract delta
Change #2 - RecordLog overload resolution (stack trace loss)Code analysis finding: the PR's stated goal is improved error diagnostics, but This is a pre-existing limitation affecting the entire Sentinel codebase, not introduced by this PR. The PR still improves the situation by routing messages through the configurable logging framework (level, format, destination) instead of raw stderr. Behavior contract# RecordLog.warn overload resolution — code analysis
- e.printStackTrace() // full stack trace to stderr
+ RecordLog.warn("msg {}", param, exception) // resolves to warn(String, Object...) varargs
// BaseJulLogger.log() discards getThrowable()
// → message logged, stack trace SILENTLY LOST
# pre-existing limitation — not introduced by this PR
# workaround: use 2-arg overload RecordLog.warn("message", e) to preserve stack traceContract delta
*Pre-existing limitation in Follow-Ups
RecommendationApprove with notes. This is a safe, low-risk logging-only change. Two independent runtime trace pairs prove zero contract divergence and confirm the head JVM starts without circular dependency issues. The main note for the PR author: due to a pre-existing |
Problem
ConfigUtil.java uses e.printStackTrace() in 3 places for error handling, which bypasses Sentinel's logging framework (RecordLog).
Impact
Fix
Replace all 3 occurrences of e.printStackTrace() with RecordLog.warn() calls that include contextual information (file name or URL being loaded).
Closes #3637
Local environment limitations, relying on CI/CD automated testing.