Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move compression into new log4j-compress module #2921

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

ppkarwasz
Copy link
Contributor

We move the code that depends on Commons Compress
into a new log4j-compress module.

At the same time, we perform the following behavioral changes:

  • Compression is performed by the CompressActionFactoryProvider, with the maximum order. In the current setting, if log4j-compress is on the classpath, it is used for everything, even GZ and ZIP.
  • The compressionLevel parameter, specific to the GZ and ZIP compression factories in the JRE, is replaced by a more generic compressionOptions map. This will allow adding more compression options in the future if users request it.
  • The available list of compression algorithms is no longer hardcoded, but depends entirely on the list of compressors supported by Apache Commons Compress.

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 RolloverStrategy implementations.
Until that happens I am reluctant to add additional features.

Review guide

The main change revolves around the replacement of FileExtension with 2 new interfaces:

  • CompressActionFactory: this class inherits the instance methods from FileExtension and 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.

@ppkarwasz ppkarwasz added this to the 3.x milestone Sep 5, 2024
@ppkarwasz ppkarwasz self-assigned this Sep 5, 2024
@ppkarwasz ppkarwasz force-pushed the feature/main/move-commons-compress2 branch from 5b21302 to 3d35565 Compare September 6, 2024 18:20
@ppkarwasz ppkarwasz requested a review from vy September 6, 2024 18:21
log4j-compress/pom.xml Outdated Show resolved Hide resolved
log4j-compress/pom.xml Outdated Show resolved Hide resolved
log4j-core/pom.xml Show resolved Hide resolved
src/site/antora/modules/ROOT/pages/components.adoc Outdated Show resolved Hide resolved
log4j-compress/pom.xml Show resolved Hide resolved
We move the code that depends on Commons Compress
into a new `log4j-compress` module.

At the same time, we perform the following behavioral changes:

- Compression is performed by the `CompressActionFactoryProvider`,
  with the maximum order. In the current setting, if
  `log4j-compress` is on the classpath, it is used for
  everything, even GZ and ZIP.
- The `compressionLevel` parameter, specific to the GZ and ZIP
  compression factories in the JRE, is replaced by a more
  generic `compressionOptions` map. This will allow
  adding more compression options in the future if users request it.
- The available list of compression algorithms is no longer
  hardcoded, but depends entirely on the list of compressors
  supported by Apache Commons Compress.

> [!NOTE]
> Currently Commons Compress does not offer an algorithm-independent
> interface to supply additional compression options.
> However, each algorithm does provide such a way.

Co-authored-by: Volkan Yazıcı <volkan@yazi.ci>
@ppkarwasz ppkarwasz force-pushed the feature/main/move-commons-compress2 branch from bd12a68 to 4867237 Compare September 24, 2024 20:49
@ppkarwasz ppkarwasz merged commit 4867237 into main Sep 24, 2024
4 of 6 checks passed
@ppkarwasz ppkarwasz deleted the feature/main/move-commons-compress2 branch September 24, 2024 20:50
Copy link

Job Requested goals Build Tool Version Build Outcome Build Scan®
build-ubuntu-latest clean install 3.9.8 Build Scan NOT_PUBLISHED
Generated by gradle/develocity-actions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants