Skip to content

run --local: tee the Mendix runtime log to a file for debugging#38

Merged
ako merged 1 commit into
mainfrom
fix/runtime-log
Jul 26, 2026
Merged

run --local: tee the Mendix runtime log to a file for debugging#38
ako merged 1 commit into
mainfrom
fix/runtime-log

Conversation

@ako

@ako ako commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Sudoku-app finding #25: mxcli run --local swallows the Mendix runtime log.

The warm loop prints its own progress (build, reload, hub), but the runtime's own stdout/stderr — server stack traces and your microflow LOG ERROR/LOG INFO output — went only into an in-memory syncBuffer that is surfaced solely on a startup failure. During normal operation it landed nowhere on disk. So when a page action threw, the browser showed the generic Mendix error dialog with nothing to correlate it against, and a server-side bug couldn't be distinguished from a client one. (In the report, an "error selecting a cell" cost real time — the whole server side had to be excluded by driving the UI and querying Postgres directly before it turned out client-side.)

Fix (the finding's own ask)

Tee the runtime JVM's stdout+stderr to <projectDir>/.mxcli/runtime.log with io.MultiWriter(buffer, file) — the in-memory buffer still backs startup-error reporting, and the file makes the running app debuggable (tail -f .mxcli/runtime.log).

  • Appended across restarts, each marked === runtime start … ===; the handle is closed on Stop and reopened on restart (no leak).
  • On by default; --runtime-log <path> relocates it, --runtime-log - disables it.
  • The path is printed at boot (Runtime log: …).
  • .mxcli/ is already excluded from the --watch signal, so the log never re-triggers a rebuild.

Tests & docs

  • TestOpenRuntimeLog — verifies dir creation, the start marker, append-across-restart (2 markers), and that the prior handle is closed on reopen.
  • run command help, run-local skill + docs-site page gain a "Debugging a server-side error" note and the flag.

(The unrelated TestServeIntegration failure in this package is an environment version mismatch — test app 11.6.3 vs local MxBuild 11.12.1 — not affected by this change.)

🤖 Generated with Claude Code


Generated by Claude Code

Findings #25: the warm loop prints its own progress but the Mendix
runtime's own stdout/stderr — server stack traces and microflow LOG
output — went only to an in-memory buffer surfaced solely on a startup
failure. So when a page action threw, the browser showed the generic
error dialog with nothing to correlate against, and a server-side bug
couldn't be told apart from a client one.

Tee the runtime JVM's stdout+stderr to <projectDir>/.mxcli/runtime.log
via io.MultiWriter(buffer, file): the in-memory buffer still backs
startup-error reporting, and the file makes the running app debuggable
(tail -f). Appended across restarts with a "=== runtime start … ==="
marker; the handle is closed on Stop and reopened on restart. On by
default; --runtime-log <path> relocates it and "-" disables it. The path
is printed at boot.

Adds TestOpenRuntimeLog and run/run-local docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
@ako
ako merged commit 6d3cde8 into main Jul 26, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants