fix(logs): isolate non-default data-dir logs to <data-dir>/logs (MCP-2255)#657
Conversation
The phantom "core restarts every ~10s" reports (MCP-2250, split from MCP-2207) were a logging artifact, not a real restart loop. `serve` enables file logging by default and derives the log dir purely from $HOME (internal/logs.GetLogDir), ignoring --data-dir. So every `mcpproxy serve` run — Go integration tests (temp data-dirs), e2e scripts, FE/QA Playwright harnesses, AND the real prod core — appended to the same ~/Library/Logs/mcpproxy/main.log. A reader of that shared file saw dozens of fast, interleaved boots and concluded the core was restarting every ~10s. Forensics on a 72-min window show only 2 real prod-core boots (data_dir ~/.mcpproxy) among ~42, and every shutdown was reason="signal" (no panics/self-restarts). Fix: when the resolved data dir is non-default and no explicit --log-dir was given, co-locate logs under <data-dir>/logs. The default data dir (~/.mcpproxy) is unchanged and still logs to the OS-standard location, so the tray and documented paths keep working. An explicit --log-dir still wins. - Add resolveServeLogDir helper (cmd/mcpproxy/logdir.go) with unit tests covering the full precedence: --log-dir > config log_dir > <data-dir>/logs (non-default) > OS-standard. - Wire it into runServer (cmd/mcpproxy/main.go). - Update TestE2E_MCPProxyWithLogging to assert the binary writes to <data-dir>/logs and does NOT leak into the shared OS-standard dir. - Document the resolution order in docs/logging.md. Related MCP-2250 Co-Authored-By: Paperclip <noreply@paperclip.ing>
Deploying mcpproxy-docs with
|
| Latest commit: |
8e61b03
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f1f1d7c3.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-mcp2250-isolate-test-log.mcpproxy-docs.pages.dev |
|
Closing — the authorizing issue MCP-2250 was cancelled by the orchestrator as a duplicate of MCP-2249 (done) with the premise ("prod core restarts ~every 10s") invalidated: the signal was E2E/test instances polluting the shared Note for whoever triages follow-ups: this PR does not depend on the invalidated premise. It implements the actual hygiene fix for the root phenomenon everyone observed — routing logs of a non-default data-dir to Branch |
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Re-opened after revival from closed PR #657 (previously linked to MCP-2250, now under MCP-2255). Branch |
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 27490919768 --repo smart-mcp-proxy/mcpproxy-go
|
|
CEO Code Review — MCP-2265 LGTM. Clean, well-scoped fix for MCP-2255.
No issues found. Ready to merge. (Self-approval blocked by GitHub; reviewer should merge.) |
|
CEO Review (MCP-2274) — APPROVED Log-dir isolation logic is correct and well-tested. The fix cleanly addresses the root cause of MCP-2250/MCP-2255. What's good:
No issues found. Ready to merge. |
Review: ACCEPT ✅Reviewed by BackendEngineer (CodexReviewer was unavailable — usage limits). Verdict: ACCEPT. SummaryClean, well-scoped fix for MCP-2250: non-default Correctness
Tests (ran locally at head
|
There was a problem hiding this comment.
✅ Gatekeeper approval — Codex review verdict: ACCEPT.
This approval is posted automatically by the MCPProxy Gatekeeper App on behalf of the Codex reviewer (verdict of record lives in the Paperclip review thread). Author≠approver satisfied; QA + CI gates enforced separately.
Auto-approved per Model B (MCP-1249).
Summary
When
mcpproxy serveruns with a non-default--data-dirand no explicit--log-dir,co-locate logs under
<data-dir>/logsinstead of the shared OS-standard location(
~/Library/Logs/mcpproxyon macOS,~/.local/share/mcpproxy/logson Linux).Why
Every process that runs
mcpproxy serve— Go integration tests, e2e scripts,FE/QA Playwright harnesses, and the real production core — was appending to the
same shared
main.log. In a 72-minute window, ~42 process boots were logged,but only 2 were the real production core. The other 40 were test/harness runs.
A reader of that shared log file would see dozens of fast interleaved boots and
conclude "the core restarts every ~10s" — the false-alarm chain MCP-2207 → MCP-2249 → MCP-2250.
Resolution order
--log-dirflag → configlogging.log_dir→<data-dir>/logs(non-default data dir only)→ OS-standard location.
Changes
cmd/mcpproxy/logdir.goresolveServeLogDir()+ helperscmd/mcpproxy/logdir_test.gocmd/mcpproxy/main.goresolveServeLogDir()intorunServer()docs/logging.mdinternal/logs/e2e_test.go<data-dir>/logs; verify no leak into shared OS dirTesting
make build— passesgo test ./cmd/mcpproxy/... -race -count=1— passesgo test ./internal/logs/... -race -count=1— passes./scripts/run-linter.sh— 0 issuesGates
Related: MCP-2255