Skip to content

test(spring-boot): [Sample Tests 16] Replace the log4j2 Boot samples' system tests with a Log4j2 suite - #6306

Draft
runningcode wants to merge 2 commits into
no/integration-tests-aggregatefrom
no/delete-log4j2-boot-system-tests
Draft

runningcode wants to merge 2 commits into
no/integration-tests-aggregatefrom
no/delete-log4j2-boot-system-tests

Conversation

@runningcode

@runningcode runningcode commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Stack (Sample Tests)


📜 Description

Deletes the system tests of sentry-samples-spring-boot-jakarta-log4j2 and sentry-samples-spring-boot-4-log4j2, and takes both samples off the system-test runner and the backend workflow. Their app code stays as examples. Their one Log4j2-specific check moves to a new integrationTestLog4j2 suite in sentry-spring-boot-jakarta and sentry-spring-boot-4.

Everything else was a byte-for-byte copy of the plain samples' tests, which now run in the integrationTest suites of sentry-spring-boot-jakarta and sentry-spring-boot-4. There was one exception:

  • The one extra assertion: the log4j2 variants' PersonSystemTest also checked that the logged error carries the Log4j integration, i.e. that Boot wired Sentry's Log4j2 appender.
  • What already covered parts of it:
    • SentryLog4j2AppenderAutoConfigurationTest in both modules checks that Spring Boot attaches the appender, and with which settings.
    • sentry-log4j2's SentryAppenderTest checks that the appender's events carry the integration.

After a coverage audit against the sample's tests:

  • What those tests missed. No test sent an event through the auto-configured appender to a server; the tests above use a mocked or no-op transport. integrationTestLog4j2 runs a servlet app with Log4j2 instead of Logback, swapped with Gradle's module replacement as Spring Boot documents. It logs an error through SLF4J and checks that the error reaches MockSentryServer with the request's feature flag and the Log4j integration. Sentry only attaches the appender with sentry.logging.enabled=true, which the samples set.
  • The module replacement only acts on a classpath with both starters, which only this suite has. The suite is in check, the Spring Boot 3 and 4 matrices and integrationTests.

💡 Motivation and Context

These two samples had 19 duplicated test classes between them, and they needed the Python runner, a packaged app and a Kafka container.

💚 How did you test it?

  • Both slimmed samples still build.
  • I checked the only difference between the log4j2 and plain PersonSystemTest with a diff.
  • integrationTestLog4j2 passes in both modules, also on Spring Boot 3.2.12 and 4.0.0. Without sentry.logging.enabled=true, its logged-error test fails because no event arrives.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

The WebFlux samples.

#skip-changelog

@sentry

sentry Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.61.0 (1) release

⚙️ sentry-android Build Distribution Settings

This was referenced Oct 20, 2026
@runningcode runningcode changed the title test(spring-boot): [Sample Tests 16] Remove the log4j2 Boot samples' system tests test(spring-boot): [Sample Tests 16] Replace the log4j2 Boot samples' system tests with a Log4j2 suite Oct 20, 2026
@runningcode
runningcode force-pushed the no/integration-tests-aggregate branch from cecf268 to d2cbac0 Compare October 21, 2026 09:19
@runningcode
runningcode force-pushed the no/delete-log4j2-boot-system-tests branch from d920038 to ab05cf1 Compare October 21, 2026 09:19
runningcode and others added 2 commits October 21, 2026 13:22
The jakarta-log4j2 and 4-log4j2 samples' system tests were copies of the
plain samples' tests, which now run in the modules' integrationTest
suites. The only addition was a check that a logged error carries the
Log4j integration. That's covered by SentryLog4j2AppenderAutoConfigurationTest,
which checks the appender Spring Boot attaches, and by sentry-log4j2's
own tests of what the appender sends.

Both samples come off the system-test runner and the backend workflow.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The log4j2 Boot samples' tests were removed as covered elsewhere, but
nothing else sends an event through the Log4j2 appender that Spring
Boot's auto-configuration attaches. integrationTestLog4j2, in
sentry-spring-boot-jakarta and sentry-spring-boot-4, runs a servlet app
with Log4j2 instead of Logback and checks that an error logged through
SLF4J reaches Sentry with the request's feature flag and the Log4j
integration, as the samples' Person test did.

Gradle's module replacement swaps the starters, as Spring Boot
documents. It only acts on a classpath with both, which only this
suite has.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@runningcode
runningcode force-pushed the no/delete-log4j2-boot-system-tests branch from ab05cf1 to ca0c043 Compare October 21, 2026 11:27

This branch has not been deployed

No deployments
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.

1 participant