ImmediateFlush setting is ignored in properties-based configuration
Christopher Schultz <[email protected]> Fri, 2 Feb 2024 17:53:55 -0500
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <[email protected]> |
All, I'm in the process of migrating an application from using the log4j 1.x API to log4j 2, and I'm still using the old properties-based configuration. I have set -Dlog4j1.compatibility=trueand so my existing log4j.properties file is being parsed, but these settings do not seem to have any effect: log4j.appender.A1=org.apache.log4j.DailyRollingFileAppender log4j.appender.A1.File = [...] log4j.appender.A1.Append = true # Spell this both ways, since log4j2 seems to Really Like PascalCase log4j.appender.A1.immediateFlush=true log4j.appender.A1.ImmediateFlush=true The behavior I see if that if I use tail -f to "watch" the file, the log messages come out in chunks, likely when a buffer has been filled and flushed. The messages are cut-off mid-message and are not up-to-date with what the application has logged. When switching to XML-based configuration, the "immediate flush" behavior is working as expected. I'm using log4j 2.17.1. I'm prepared to switch-over to using XML-based configuration in general, but making this work will certainly improve the migration path for lingering users of log4j 1.x. Thanks! -chris