Skip to content

Conversation

ppkarwasz
Copy link
Contributor

This change introduces AOT runtime hints for Log4j Core 2 to support its integration with Spring Boot native images.

Starting with version 2.25.0, Log4j Core 2 includes built-in GraalVM reachability metadata, allowing native image generation without requiring additional manual configuration.

This contribution complements that by adding Spring Boot–specific metadata:

  • Registers default Spring Boot configuration files.
  • Registers classes referenced via ClassUtils.isPresent(...) checks.

Fixes #42273.

Note

This change should be reviewed in conjunction with #46334, which configures Log4j Core’s GraalVmProcessor to generate reachability metadata for Spring Boot’s custom Log4j plugins.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 12, 2025
@snicoll snicoll changed the title Add AOT runtime hints for Log4j Core 2 Add native image support for Log4J integration Aug 20, 2025
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 20, 2025
@snicoll snicoll added this to the 4.0.x milestone Aug 20, 2025
@mhalbritter mhalbritter self-assigned this Aug 29, 2025
@mhalbritter
Copy link
Contributor

Blocked on #46334.

@mhalbritter mhalbritter added the status: blocked An issue that's blocked on an external project change label Aug 29, 2025
@mhalbritter mhalbritter removed their assignment Aug 29, 2025
@snicoll snicoll removed the status: blocked An issue that's blocked on an external project change label Sep 29, 2025
Copy link
Member

@snicoll snicoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ppkarwasz thanks for the PR. can you please review the comments and rebase now that we have upgraded to 2.25.x

Also, wondering about Jackson as we've moved to Jackson 3 by default and users would have then to bring Jackson 2 to be able to parse a YAML configuration?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Sep 29, 2025
@snicoll
Copy link
Member

snicoll commented Oct 7, 2025

rebase now that we have upgraded to 2.25.x

Unfortunately the rebase isn't done properly. If I try to squash all those commits into one, I am getting back to merge conflicts. Can you please sort that out?

This change introduces AOT runtime hints for Log4j Core 2 to support its integration with Spring Boot native images.

Starting with version `2.25.0`, Log4j Core 2 includes built-in GraalVM reachability metadata, allowing native image generation without requiring additional manual configuration.

This contribution complements that by adding Spring Boot–specific metadata:

* Registers default Spring Boot configuration files.
* Registers classes referenced via `ClassUtils.isPresent(...)` checks.

Fixes spring-projects#42273.

> [!NOTE]
> This change should be reviewed in conjunction with spring-projects#46334, which configures Log4j Core’s `GraalVmProcessor` to generate reachability metadata for Spring Boot’s custom Log4j plugins.

Signed-off-by: Piotr P. Karwasz <[email protected]>
@ppkarwasz ppkarwasz force-pushed the fix/42273_spring-log4j-runtime-hints branch from b4af397 to 06fc66c Compare October 7, 2025 14:20
@ppkarwasz
Copy link
Contributor Author

I usually merge instead of rebasing, since this helps reviewers to incrementally follow the changes. In 06fc66c I did a real rebase, hope it helps.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Oct 7, 2025
Signed-off-by: Piotr P. Karwasz <[email protected]>
@snicoll snicoll self-assigned this Oct 8, 2025
@snicoll snicoll modified the milestones: 4.0.x, 4.0.0-RC1 Oct 8, 2025
@snicoll snicoll removed the status: feedback-provided Feedback has been provided label Oct 8, 2025
snicoll pushed a commit that referenced this pull request Oct 8, 2025
This change introduces runtime hints for Log4j Core 2 to support its
integration with Spring Boot native images.

Starting with Log4j 2.25.x, Log4j includes built-in GraalVM reachability
metadata, allowing native image generation without requiring additional
manual configuration.

This contribution complements that by adding Spring Boot–specific
metadata:

* Registers default Spring Boot configuration files.
* Registers classes referenced via `ClassUtils.isPresent(...)` checks.

See gh-46410

Signed-off-by: Piotr P. Karwasz <[email protected]>
snicoll added a commit that referenced this pull request Oct 8, 2025
@snicoll snicoll closed this in b66509b Oct 8, 2025
@ppkarwasz ppkarwasz deleted the fix/42273_spring-log4j-runtime-hints branch October 8, 2025 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log4j2 classpath resource not found when using Spring Boot and GraalVM
4 participants