+1 on delegating this to Log4j2's native composite configuration. Re-implementing configuration merging inside KafkaDockerWrapper duplicates what DefaultMergeStrategy already handles, and letting Log4j2 merge a generated override file with the base config is much cleaner to maintain. It also nicely handles cases where users mount a custom base file in a non-YAML format (like XML or properties), which a custom YAML rewriter can't easily support.
On Sun, Nov 15, 2026 at 10:40 AM Chia-Ping Tsai <[email protected]> wrote: > > Hi all, > > I'd like to raise a behavior change to the wrapper of our Docker image > (KafkaDockerWrapper). > > Our wrapper supports configuring the log4j2 yaml via env, but it has many > issues after we migrated to log4j2 (KAFKA-21460, KAFKA-21520). The root > cause is that we are re-implementing the log4j2 composition in Kafka. > > That is weird to me. As an OSS project, why don't we reuse the log4j2 > composition instead of maintaining a duplicate implementation that does not > work well? To be fair, I am the one who merged it, so I am mostly > complaining about myself. > > Therefore, I'd like to propose delegating this function to log4j2 itself. > We can generate an extra yaml file according to the envs, and then pass the > original yaml together with this extra yaml file via the log4j2 composite > configuration. > > Of course, the delegation brings both good things and bad things. I can > list all of them later if anyone has enough tokens to parse this mail, but > it would be good to hear any feedback about this idea first. > > Best, > Chia-Ping
