GitHub user stoyanpetrov1920-spec created a discussion: Does Log4j2 compress 
rolled log files concurrently with writing to the new log file?

In Log4j 2, when using a DirectWriteRolloverStrategy with compression enabled 
(e.g., filePattern="app-%d{yyyy-MM-dd}.log.xz"), does the framework perform 
compression of the rolled file and writing to the new active log file 
concurrently?

In other words, after a rollover trigger (time or size-based), does Log4j start 
writing new log events to the fresh file immediately while compressing the old 
file in a background thread — or does the compression need to finish before 
logging resumes?

I couldn’t find a clear statement about this behavior in the official Log4j 2 
documentation or API reference. Any pointers or clarification on whether 
compression and new file writes happen in parallel would be appreciated.

The reason I’m asking is that our team is evaluating switching from gzip to xz 
compression for rolled files. However, xz compression time for ~100 MB logs is 
quite high. If rollover and writing to the new file occur sequentially, that 
delay might block logging and impact performance, so we may need to consider 
other strategies.

GitHub link: https://github.com/apache/logging-log4j2/discussions/3964

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to