katstack opened a new pull request, #4448:
URL: https://github.com/apache/logging-log4j2/pull/4448

   Port of #4234 to `main`. In `main`, a configured `compressionLevel` is 
ignored because the strategies always pass an empty `options` map to 
`CompressActionFactory`.
   
   The attribute is passed in the `compressionLevel` option and is interpreted 
as the native compression level of the algorithm. It applies to `zip`, `gz`, 
`bzip2`, `deflate` and `zstd`, as in 2.x. A level the algorithm does not 
support is reported once and the default level is used, except for `zstd`, 
which adjusts levels outside of its range. With a level, the compressor of the 
algorithm is created directly instead of through the 
`CompressorStreamProvider`, because that interface cannot take a level.
   
   These algorithms ignore the option with a warning:
   
   - `xz`, because #4234 does not apply levels to it either,
   - `lzma`, because setting the level needs `org.tukaani.xz.LZMA2Options` and 
`log4j-compress` does not have `xz` as a compile dependency,
   - `lz4-block`, `lz4-framed` and `snappy-framed`, because Commons Compress 
has no numeric level for them.
   
   ## Differences from 2.x
   
   - An unsupported level is reported at the first rollover, when the first 
compression action is created. 2.x reports it at startup, when the 
`RollingFileManager` is created.
   - Reporting it at startup here would require one of the following, so I 
implemented neither:
     - a new method on `CompressActionFactory` to validate the options, which 
extends the public API,
     - calling `createCompressAction` with placeholder file names just to 
trigger the warning, which could have side effects in third-party factories.
   - A `zstd` level outside of the range of Zstandard is adjusted by Zstandard 
without a warning. 2.x reports it and uses the default level.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to