-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add support for concatenated plugin caches #2887
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
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xmlns="https://logging.apache.org/xml/ns" | ||
| xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd" | ||
| type="added"> | ||
| <description format="asciidoc">Add support for concatenated `Log4j2Plugins.dat` files.</description> | ||
| </entry> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -281,3 +281,48 @@ See `@PluginElement("EventTemplateAdditionalField")` usage in {project-github-ur | |||||||||
| link:../javadoc/log4j-core/org/apache/logging/log4j/core/config/plugins/util/PluginUtil.html[`PluginUtil`], | ||||||||||
| which is a convenient wrapper around <<#plugin-discovery,`PluginManager`>>, to discover and load plugins. | ||||||||||
| See {project-github-url}/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/resolver/TemplateResolverFactories.java[`TemplateResolverFactories.java`] for example usages. | ||||||||||
|
|
||||||||||
| [#plugin-merge] | ||||||||||
| == Merging plugin descriptors | ||||||||||
|
|
||||||||||
| The plugin descriptor is located in a JAR file at the following fixed location: | ||||||||||
| ---- | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat | ||||||||||
| ---- | ||||||||||
|
|
||||||||||
| Some deployment techniques like | ||||||||||
| https://softwareengineering.stackexchange.com/questions/297276/what-is-a-shaded-java-dependency[shading] | ||||||||||
| require multiple plugin descriptors to be merged into one. | ||||||||||
| This can be done in multiple ways: | ||||||||||
|
|
||||||||||
| * By using a resource transformer specialized in `Log4j2Plugins.dat` files. | ||||||||||
| We are aware of the existence of the following resource transformers for different Java build tools: | ||||||||||
|
|
||||||||||
| https://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]::: | ||||||||||
| You can use the | ||||||||||
| https://logging.staged.apache.org/log4j/transform/log4j-transform-maven-shade-plugin-extensions.html#log4j-plugin-cache-transformer[Log4j Plugin Descriptor Transformer]. | ||||||||||
|
|
||||||||||
| https://gradleup.com/shadow/[Gradle Shadow Plugin]::: | ||||||||||
| You can use the | ||||||||||
| https://github.com/GradleUp/shadow/blob/main/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/Log4j2PluginsCacheFileTransformer.groovy[`Log4j2PluginsCacheFileTransformer`]. | ||||||||||
|
|
||||||||||
| * Since version `2.24.0` you can any resource transformer capable of concatenating files using `\n` as separator. | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
| The following resource transformers are known to exist: | ||||||||||
|
|
||||||||||
| https://github.com/sbt/sbt-assembly[SBT Assembly Plugin]::: | ||||||||||
| You can use `MergeStrategy.concat`. | ||||||||||
| See | ||||||||||
| https://github.com/sbt/sbt-assembly?tab=readme-ov-file#merge-strategy[SBT Assembly Merge Strategy] | ||||||||||
| for details. | ||||||||||
|
|
||||||||||
| https://maven.apache.org/plugins/maven-shade-plugin/[Maven Shade Plugin]::: | ||||||||||
| You can use the standard `AppendingTransformer`. | ||||||||||
| See | ||||||||||
| https://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer[Maven Shade Plugin Resource Transformers] | ||||||||||
| for details. | ||||||||||
|
|
||||||||||
| https://gradleup.com/shadow/[Gradle Shadow Plugin]::: | ||||||||||
| You can use the standard `AppendingTransformer`. | ||||||||||
| See | ||||||||||
| https://gradleup.com/shadow/configuration/merging/#appending-text-files[Appending Text Files] | ||||||||||
| in the Gradle Shadow Plugin documentation for details. | ||||||||||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I'd prefer
createSampleCache()accept categories and entries, instead of assuming hardcoded values will be identical in multiple places.