Skip to content

Fix azure-core native image logging initialization#49855

Open
arnabnandy7 wants to merge 2 commits into
Azure:mainfrom
arnabnandy7:fix/native-image-slf4j-fallback
Open

Fix azure-core native image logging initialization#49855
arnabnandy7 wants to merge 2 commits into
Azure:mainfrom
arnabnandy7:fix/native-image-slf4j-fallback

Conversation

@arnabnandy7

Copy link
Copy Markdown
Contributor

Description

Fixes #49844.

This pull request fixes GraalVM Native Image compilation failures involving SLF4J 2 and Spring Boot 4.1.

Azure Core's native-image metadata previously forced SLF4J, logging providers, and Azure Core logging classes to initialize at image build time. With GraalVM 25, this could place SLF4J fallback providers such as SubstituteServiceProvider and NOP_FallbackServiceProvider in the image heap while those classes were configured for runtime initialization.

This change:

  • Removes build-time initialization directives for SLF4J, Logback, Log4j, and Azure Core logging classes.
  • Allows logging provider discovery and initialization to occur at application runtime.
  • Documents the GraalVM Native Image logging behavior in the Azure Core README.
  • Adds an entry to the Azure Core CHANGELOG.

No public APIs are changed.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

The change affects packaged GraalVM reachability metadata and does not introduce executable Java logic suitable for a unit test. Validation performed:

git diff --check

Built the Azure Core package successfully on Java 21:

mvn -f sdk/core/azure-core/pom.xml package -DskipTests -Dspotbugs.skip=true -Dcheckstyle.skip=true

Inspected the packaged native-image.properties and confirmed it no longer contains build-time initialization directives for SLF4J, Logback, Log4j, or Azure Core logging classes.

Copilot AI review requested due to automatic review settings July 17, 2026 08:19
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
34 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@github-actions github-actions Bot added Azure.Core azure-core Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization. labels Jul 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution @arnabnandy7! We will review the pull request and get back to you soon.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates azure-core GraalVM Native Image reachability metadata to avoid forcing SLF4J/logging classes to initialize at image build time, addressing native-image compilation failures seen with SLF4J 2 + Spring Boot 4.1 + GraalVM 25 (Issue #49844).

Changes:

  • Removed --initialize-at-build-time directives for SLF4J, Logback, Log4j, and Azure Core logging classes from azure-core native-image metadata.
  • Documented the intended GraalVM Native Image logging initialization behavior in the Azure Core README.
  • Added a changelog entry describing the native-image compilation fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
sdk/core/azure-core/src/main/resources/META-INF/native-image/com.azure/azure-core/native-image.properties Removes build-time init rules for logging-related classes to allow provider discovery at runtime.
sdk/core/azure-core/README.md Adds guidance about GraalVM Native Image behavior for logging initialization.
sdk/core/azure-core/CHANGELOG.md Records the native-image logging initialization fix under Bugs Fixed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread sdk/core/azure-core/README.md
Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure.Core azure-core Community Contribution Community members are working on the issue customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] azure-core native-image metadata initializes SLF4J fallback provider with Spring Boot 4.1 / GraalVM 25

2 participants