Repository navigation
Conversation
…on Adobe ColdFusion
RollingFileAppenderTest writes to the same MyFileAppender.log from its listener thread, so when it ran first the exact line count saw its leftover lines.
homestar9
marked this pull request as ready for review
October 19, 2026 19:23
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.
Description
On Adobe ColdFusion,
FileAppenderandRollingFileAppenderwrite queued lines several times:N lines queued together end up N + (N-1) + … + 1 times in the file, and each one is also printed
to the console.
The log listener passes its queue to
preProcessQueue()as an argument. Adobe ColdFusion passesarrays by value, so
FileAppender'squeue.clear()empties a copy. The listener then takes oneline off the real queue, prints it to the console through the base
processQueueElement(), andthe next pass writes everything left again. Lucee and BoxLang pass arrays by reference, so they
are not affected. Setting
this.passArrayByReference = trueon ACF 2023 also makes the unchangedcode write each line once, which confirms the cause.
Changes:
AbstractAppender: a new privatedrainQueue()removes and returns the queued entries fromthe appender's own queue (
variables.logListener.queue), so it works whichever way the enginepasses arrays. It removes exactly the entries it read rather than calling
clear(), so a linequeued during the write is kept for the next pass. On every engine, that line could be lost
before.
FileAppender.preProcessQueue()writesdrainQueue()and ignores the argument.FileAppender.processQueueElement()(new) writes a line the listener takes off the queueitself to the file instead of the console.
preProcessQueue,postProcessQueueandprocessQueueElementdocblocks now say thequeueargument may be a copy and should only be read.Hook signatures are unchanged, so custom appenders that override them keep working. The fix does
not depend on
this.passArrayByReference, which most applications don't set.Jira Issues
https://ortussolutions.atlassian.net/browse/COLDBOX-1467
Type of change
Checklist
Tests
New specs in
FileAppenderTest.cfc, using a small test appender (QueueTestFileAppender.cfc)that runs the listener in the test thread, so no sleeping is needed. The existing "can log
messages" spec now checks for an exact line count; before, it only checked that the text
appeared, which is why this was missed.
tests/specs/logging, after the fix