Move compression into new log4j-compress module #2921
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
We move the code that depends on Commons Compress
into a new
log4j-compressmodule.At the same time, we perform the following behavioral changes:
CompressActionFactoryProvider, with the maximum order. In the current setting, iflog4j-compressis on the classpath, it is used for everything, even GZ and ZIP.compressionLevelparameter, specific to the GZ and ZIP compression factories in the JRE, is replaced by a more genericcompressionOptionsmap. This will allow adding more compression options in the future if users request it.Note
Currently Commons Compress does not offer an algorithm-independent
interface to supply additional compression options. However, each algorithm does provide such a way.
If there are requests from users to support these options, we can extend the
RolloverStrategyimplementations.Until that happens I am reluctant to add additional features.
Review guide
The main change revolves around the replacement of
FileExtensionwith 2 new interfaces:CompressActionFactory: this class inherits the instance methods fromFileExtensionand allows to create lambdas that compress files.CompressActionFactoryProvider: a new Log4j plugin type that can be used to register new compression algorithms. In practice there are two implementations (one for the algos in the JRE and one for Apache Commons Compress). All the remaining compression algorithms should extend Commons Compress.