Alex Lambert created LOG4J2-3639:
------------------------------------

             Summary: RollingFileAppender: Add option to allow compression of 
logs as they are written
                 Key: LOG4J2-3639
                 URL: https://issues.apache.org/jira/browse/LOG4J2-3639
             Project: Log4j 2
          Issue Type: New Feature
          Components: Appenders
            Reporter: Alex Lambert


We have a forked implementation of this functionality that I’m hoping to get 
merged in – I'm raising this issue now just in case there are any obvious 
problems with taking the feature that should be addressed before that starts.
h2. Summary

The motivation is to add an option to allow compression of log content before 
it is written to file, saving on I/O operations. There was some discussion 
around this in [RollingFileAppender enhancement for file compression-Apache 
Mail 
Archives|https://lists.apache.org/thread/0wj82d168dcjozcd3fdnp6gk9mm1goy0]. A 
couple of issues were raised:
 * Leaving the file in a bad state after the application dies.
 * Reading the file as it is written.

Both of these are resolved by making sure that the file is in a valid state 
after each write, described in the next section.
h2. Proposed Change

Add new config option to RollingFileAppender “compressOnWrite”. If true, write 
to a GZIPOutputStream instead of a FileOutputStream. Skip the compression 
action step on rollover if this config option is set. Close the gzip stream 
between writes to ensure that the log file is always in a valid state.

We only have this functionality implemented for gzip compression right now.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to