Skip to content

Avoid referring to PluginBuilderAttribute.class in PluginProcessor#4041

Merged
vy merged 2 commits intoapache:2.xfrom
cushon:PluginProcessor
Mar 16, 2026
Merged

Avoid referring to PluginBuilderAttribute.class in PluginProcessor#4041
vy merged 2 commits intoapache:2.xfrom
cushon:PluginProcessor

Conversation

@cushon
Copy link
Copy Markdown
Contributor

@cushon cushon commented Jan 29, 2026

This makes it easier to build PluginProcessor by itself separately from the rest of log4j-core, and then include that processor when building the rest of core, instead of having to compile all of core twice.

This makes it easier to build PluginProcessor by itself separately from the rest of log4j-core,
and then include that processor when building the rest of core, instead of having to compile
all of core twice.
@vy
Copy link
Copy Markdown
Member

vy commented Feb 28, 2026

@cushon, I'm sorry for the late reply. All of my Log4j time was sucked by AI slop — Piotr mentioned about it in #4052.

This makes it easier to build PluginProcessor by itself separately from the rest of log4j-core, and then include that processor when building the rest of core, instead of having to compile all of core twice.

If so, we should be able to simplify the maven-compiler-plugin configuration in the plugin-processing profile in /log4j-parent/pom.xml too, right? Can we carry out this change too, please?

@vy vy self-assigned this Feb 28, 2026
@vy vy added enhancement Additions or updates to features build Affects the build system or other automation plugins Affects the plugin system labels Feb 28, 2026
@cushon
Copy link
Copy Markdown
Contributor Author

cushon commented Mar 1, 2026

@vy thanks for taking a look!

If so, we should be able to simplify the maven-compiler-plugin configuration in the plugin-processing profile in /log4j-parent/pom.xml too, right? Can we carry out this change too, please?

I'm open to trying that, I'm not sure exactly how it would work yet. I noticed this issue trying to build log4j2 with Bazel, not using the maven build, I am less familiar with maven.

This change makes it possible to build the plugins by building just the following sources:

org/apache/logging/log4j/core/config/plugins/processor/**/*.java
org/apache/logging/log4j/core/config/plugins/Plugin.java
org/apache/logging/log4j/core/config/plugins/PluginAliases.java
org/apache/logging/log4j/core/util/JsonUtils.java

So it would still be necessary to compile those parts of log4j-core twice, but it might be possible to compile just the above sources in the first phase.

Another option I was wondering about is whether it might be possible to move these processors to a separate maven submodule, to compile them separately before log4j-core, and avoid the need for the maven-compiler-plugin configuration that compiles in two phases. Do you think that's worth considering?

@vy vy changed the title Avoid referring to PluginBuilderAttribute.class in PluginProcessor Avoid referring to PluginBuilderAttribute.class in PluginProcessor Mar 16, 2026
@vy
Copy link
Copy Markdown
Member

vy commented Mar 16, 2026

I noticed this issue trying to build log4j2 with Bazel

Would you mind elaborating on this a bit, please? Do you have an in-house Log4j build using Bazel?

Another option I was wondering about is whether it might be possible to move these processors to a separate maven submodule, to compile them separately before log4j-core, and avoid the need for the maven-compiler-plugin configuration that compiles in two phases. Do you think that's worth considering?

That'd be a disruptive change. PluginProcessor users will need to adapt their class paths. Log4j 3 will have that modularity, but its release date is still uncertain.

@vy vy enabled auto-merge (squash) March 16, 2026 09:20
@vy vy merged commit 0f7f2c7 into apache:2.x Mar 16, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Log4j pull request tracker Mar 16, 2026
@github-actions
Copy link
Copy Markdown

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

@cushon
Copy link
Copy Markdown
Contributor Author

cushon commented Mar 16, 2026

I noticed this issue trying to build log4j2 with Bazel

Would you mind elaborating on this a bit, please? Do you have an in-house Log4j build using Bazel?

Yes, we have in-house Bazel builds for some dependencies as an alternative to maven/gradle builds or published prebult jars.

ppkarwasz pushed a commit that referenced this pull request Mar 25, 2026
#4041)

This makes it easier to build `PluginProcessor` by itself
separately from the rest of `log4j-core`, and then include
that processor when building the rest of core, instead of
having to compile all of core twice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Affects the build system or other automation enhancement Additions or updates to features plugins Affects the plugin system

Projects

Development

Successfully merging this pull request may close these issues.

2 participants