Repository navigation
Conversation
Messages logged from a thread started by the task are currently dropped, as AntTaskHolder does not make the task available to other threads. This test fails until that is changed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
AntTaskHolder used a plain ThreadLocal since the move to the SLF4J 2 service provider (dfa99e8). The engine runs analyzers in executor threads, where no task was set, so AntLoggerAdapter dropped all their messages, e.g. "Suppression Rule had zero matches" of the UnusedSuppressionRuleAnalyzer. Use an InheritableThreadLocal so threads started by the task log through it, while parallel Ant tasks stay apart. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
tinobino
force-pushed
the
fix/ant-logging-worker-threads
branch
from
November 3, 2026 09:25
1118d19 to
5e06f37
Compare
chadlwilson
approved these changes
Nov 3, 2026
This branch has not been deployed
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 of Change
Since the move to the SLF4J 2 service provider (dfa99e8, released in 12.2.1),
AntTaskHolderkeeps the current Ant task in a plainThreadLocal. The task is only set on the Ant main thread (in theCheck,UpdateandPurgeconstructors/execute), butEngine.executeAnalysisTasksrunsanalyzeDependencyin executor threads. ThereAntTaskHolder.getTask()returnsnull, andAntLoggerAdaptersilently drops the message.As a result, everything logged from analyzers while running as an Ant task is lost. For example the
UnusedSuppressionRuleAnalyzerlogsSuppression Rule had zero matches: ...at INFO, but nothing shows up in the Ant output, although the analyzer itself runs (Finished Unused Suppression Rule Analyzeris logged from the main thread and is visible). Before dfa99e8,StaticLoggerBinderheld the task in a process-wide singleton, so these messages were shown.This change makes
AntTaskHolderuse anInheritableThreadLocal. Threads started by the task (such as the engine's analysis threads) inherit the task and log through it, while parallel Ant tasks still do not see each other's task, which was the reason for theThreadLocalin the first place.Note:
AntTaskHolder.remove()only clears the value of the calling thread. The executors inEngineare created per analyzer and shut down afterwards, so they do not keep a stale task.Related issues
ThreadLocal)Have test cases been added to cover the new functionality?
yes
AntSlf4jServiceProviderTest.testLogOutputOfWorkerThreadRoutedThroughAntTasklogs from an executor thread and verifies that the message reaches the Ant task. It fails without this change ("zero interactions with this mock") and passes with it.