Conversation
… set The console.log/info/warn/error overrides in ProcessContainerBun.js only appended a trailing newline in the plain branch. With log_date_format set, every entry was written without one, so cluster mode log files under Bun ran all entries together on a single line. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
test/e2e/cli/bun.shon Bun 1.4.2, Linux)Problem
When PM2 runs on Bun, cluster mode apps use
lib/ProcessContainerBun.js, which overridesconsole.log/info/warn/error. When the message has no trailing newline, only the branch with nolog_date_formatadds one. Withlog_date_formatset, each entry is written as`${date}: ${msg}`with no newline, so the out and error log files put every entry on one line:pm2 logsstill looks correct while streaming, because it prints each bus packet on its own line. Only the log files on disk (and thepm2 logshistory shown at startup, which is read from those files) are affected. Fork mode and Node cluster mode are unaffected. Reproduced on 7.0.4 and on currentdevelopment.Fix
Normalize the trailing newline once and use it for both the dated and the plain output. JSON output (
log_type: json) and theprocess.stdout.write/process.stderr.writeoverrides are unchanged, since those writers already pass through whatever newline the caller includes.Test
Added a case to
test/e2e/cli/bun.sh. It starts a fixture in cluster mode (-i 1) with--log-date-format "YYYY", logs two lines to stdout and two to stderr, then checks that each entry is on its ownYYYY: messageline in both log files. Without the fix, the out-log check fails. With the fix, the whole ofbun.shpasses.🤖 Generated with Claude Code