Flush console streams to preserve log order - #914
Open
arimu1 wants to merge 2 commits into
Open
Conversation
Rewrite chronologicalOrderWithBufferedStandardOutputStream to observe writes at the underlying OutputStream sink with a BufferedOutputStream on stdout, so the test fails when ConsoleWriter.write() omits flush(). Update stale flush comment in errorOutputStreamForEmptyLogger.
arimu1
force-pushed
the
fix/849-log-order
branch
from
August 15, 2026 03:06
6a7e14c to
f1bb87e
Compare
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
consolewriter with mixed severity levels (e.g. TRACE/DEBUG/INFO followed by WARN/ERROR).ConsoleWriterroutes WARN and ERROR toSystem.errand lower levels toSystem.out. WhenSystem.outis block-buffered (common in IDE run consoles and piped output), stderr lines become visible before buffered stdout lines even though they were logged later.flush()for both stdout and stderr so entries appear in logging order.Test plan
chronologicalOrderWithBufferedStandardOutputStreaminConsoleWriterTestreproducing the interleaved level sequence from Logs will not be written in correct order #849 with a non-autoflush stdout streammvn clean verify(requires JDK 9 per CONTRIBUTING.md)Fixes #849
Made with Cursor