run --local: attach a file log subscriber so application logs are captured#39
Merged
Conversation
…tured The runtime-log tee added earlier writes the runtime JVM's stdout/stderr to .mxcli/runtime.log, but a standalone runtime (launched via runtimelauncher.jar) attaches no log subscriber by default — unlike a Studio Pro / m2ee run, which calls create_log_subscriber after start. Mendix application logs flow to log subscribers, not stdout, so microflow LOG output and server-side exception stack traces never reached the file: a page-action error still showed only the generic Mendix dialog with nothing to correlate against. After a successful start (and on every restart's Start, since each fresh JVM starts with no subscriber), attach a "file" log subscriber pointing at the same runtime.log with autosubscribe INFO. max_rotate is 0 so the runtime never renames the file out from under the JVM tee's open handle; the path is passed absolute because the runtime's cwd is <install>/runtime, not mxcli's. The attach is best-effort — a logging failure warns to stdout rather than failing an otherwise-healthy start. Tests: TestStart_AttachesLogSubscriber (params), TestStart_NoLogSubscriberWhenUnset, TestStart_LogSubscriberFailureNonFatal. Docs: run-local skill, docs-site, and the fix-issue symptom table (findings #25, round 2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JXnEgoc2NQP1Y2TWMCMXC4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Round 2 of findings #25. PR #38 tee'd the runtime JVM's stdout/stderr to
.mxcli/runtime.log, but a re-test on the Sudoku app showed the file stays nearly empty: microflowLOGoutput and server-side exception stack traces never appear, so a page-action error still can't be diagnosed (the browser only shows the generic Mendix dialog).Root cause: a standalone runtime launched via
runtimelauncher.jarattaches no log subscriber by default — unlike a Studio Pro / m2ee run, which callscreate_log_subscriberafter start. Mendix application logs flow to log subscribers, not stdout, so with none attached they go nowhere.Fix
After a successful
start(and on every restart'sStart, since each fresh JVM has no subscriber), attach afilelog subscriber via thecreate_log_subscriberadmin action, mirroring m2ee-tools' post-start_configure_logging:max_rotate: 0is load-bearing — the JVM stdout tee (PR run --local: tee the Mendix runtime log to a file for debugging #38) holds an open fd on the same file, and a rotate-rename would detach it. Both writers append.<install>/runtime, not mxcli's).--runtime-log -disables the subscriber too.Tests
TestStart_AttachesLogSubscriber— asserts the params (type/filename/autosubscribe/name/max_rotate:0) after a successful start.TestStart_NoLogSubscriberWhenUnset— no subscriber whenLogSubscriberFileis empty.TestStart_LogSubscriberFailureNonFatal— a failingcreate_log_subscriberdoes not failStart; it warns instead.All docker unit tests pass; the only failure is the pre-existing environmental
TestServeIntegration(test app 11.6.3 vs MxBuild cache 11.12.1), unrelated to this change.Docs
runhelp text,run-localskill, and docs-site "Debugging a server-side error" now explain that two sources feedruntime.log(JVM tee + file log subscriber) and why.fix-issue.mdsymptom table extended with the round-2 entry.🤖 Generated with Claude Code
Generated by Claude Code