abhinav-phi opened a new pull request, #4325:
URL: https://github.com/apache/logging-log4j2/pull/4325

   Fixes #4262.
   
   **Description**
   
   The `Console` appender plugin accepts `immediateFlush`, `bufferedIo` and 
`bufferSize` through `AbstractOutputStreamAppender.Builder`, but its `build()` 
never used them: the private constructor hardcoded `true` for the flush flag, 
so a configured `immediateFlush="false"` was silently dropped (same for the 
buffering attributes, see the issue). This PR passes the builder value through 
so the setting is honored, per the fix plan in the issue.
   
   - pass `isImmediateFlush()` into the constructor instead of the hardcoded 
`true`
   - keep `createDefaultAppenderForLayout` on `true` so `DefaultConfiguration` 
keeps flushing after every event
   - drop the `bufferSize` docs row for Console: the attribute is not honored 
by `build()`, and the shared manager key (`target.follow.direct`) makes 
honoring it a design decision rather than a patch (raised in the issue)
   - red-green coverage in `ConsoleAppenderTest`: configured `false` asserts 
`getImmediateFlush()` is `false`, omitted keeps the default `true`, and 
`createDefaultAppenderForLayout` stays `true`
   - one-line changelog entry under `src/changelog/.2.x.x`
   
   **Testing**
   
   - before the fix: `testImmediateFlushFalse` fails with `expected: <false> 
but was: <true>` (verified locally, 7 tests run)
   - after the fix: `ConsoleAppenderTest` 7/7 and `ConsoleAppenderBuilderTest` 
3/3 pass with `./mvnw -pl :log4j-core-test -am test 
-Dtest=ConsoleAppenderTest,ConsoleAppenderBuilderTest` on JDK 17
   - `spotless:check` clean on both changed modules
   
   **Checklist**
   
   * Based on `2.x` ✓
   * Tests provided ✓
   * Changelog entry ✓
   
   AI-assisted change (this PR description was drafted with AI assistance and 
reviewed by me); code changes are mine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to