Skip to content

Move the remaining log4j 1.x API uses to log4j2 - #539

Open
NicoPiel wants to merge 4 commits into
OpenIntegrationEngine:mainfrom
NicoPiel:modernise/log4j1-api
Open

NicoPiel wants to merge 4 commits into
OpenIntegrationEngine:mainfrom
NicoPiel:modernise/log4j1-api

Conversation

@NicoPiel

Copy link
Copy Markdown
Contributor

What

Moves the last Java uses of the log4j 1.x API to log4j2:

  • DefaultDebugUsageController now uses LogManager/Logger like the other controllers.
  • ExtensionStatuses and ExtensionStatusProvider look up org.apache.logging.log4j.LogManager reflectively instead of org.apache.log4j.Logger.

Why

These were the only Java callers of the 1.2 bridge API. The bridge itself stays, because the generated transformer script still exposes org.apache.log4j.Logger to user scripts.

Reviewer notes

  • The extprops classes are packed into the launcher jar, which has no log4j on its classpath, so they keep the reflective lookup through the context classloader. That's the same lookup and LoggerWrapper usage MirthLauncher already does.
  • Verified with ./gradlew :server:compileJava and DebugUsageControllerTest. No automated test covers the extprops path.

🤖 Generated with Claude Code

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
The launcher jar has no log4j on its classpath, so the logger is still looked up through the context classloader, the same way MirthLauncher already does it.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Test Results

128 files   - 2  128 suites   - 2   3m 48s ⏱️ +37s
788 tests  - 1  788 ✅  - 1  0 💤 ±0  0 ❌ ±0 
914 runs   - 1  908 ✅  - 1  6 💤 ±0  0 ❌ ±0 

Results for commit dd012af. ± Comparison against base commit 4589238.

This pull request removes 3 and adds 2 tests. Note that renamed tests count towards both.
com.mirth.connect.connectors.ws.WebServiceConnectorServletTest ‑ testCommonsSSL
com.mirth.connect.donkey.server.data.jdbc.OracleJdbcDaoTest ‑ testBatchInsertMessageContentKeepsStatementOpenUntilExecuted
com.mirth.connect.donkey.server.data.jdbc.OracleJdbcDaoTest ‑ testFailedBatchInsertClearsAndClosesTheStatement
com.mirth.connect.donkey.server.data.jdbc.JdbcDaoTest ‑ insertMessageContentBatchBatchesEveryRowThenExecutesOnce
com.mirth.connect.donkey.server.data.jdbc.JdbcDaoTest ‑ insertMessageContentBatchClosesTheStatementWhenBindingFails

♻️ This comment has been updated with latest results.

gibson9583
gibson9583 previously approved these changes Oct 30, 2026

@gibson9583 gibson9583 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.

Looks safe to merge.

mgaffigan
mgaffigan previously approved these changes Oct 30, 2026
@mgaffigan

Copy link
Copy Markdown
Contributor

Let's kill the bridge, too. We don't want to break user scripts unnecessarily, but this one seems like it can be compensated by a plugin - and the scripts have had a decade or two to update.

Nothing in the engine calls the log4j 1.x API any more, so remove
log4j-1.2-api from the distribution. slf4j-log4j12 bound slf4j to the
log4j 1.x classes the bridge provided, so replace it with
log4j-slf4j-impl. The transformer script now resets its logger through
the log4j2 LogManager.

The vendored not-going-to-be-commons-ssl jar called log4j 1.x directly
and was only kept for SoapUI, which the engine no longer uses. Remove
it together with its regression test and the leftover SoapUI log4j
config.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
@NicoPiel
NicoPiel dismissed stale reviews from mgaffigan and gibson9583 via e831ac2 October 30, 2026 15:50
MyBatis 3.1.1 has no log4j2 adapter, and its log4j adapter needs the
log4j 1.x classes the bridge used to provide, so the server could not
start. commons-logging hands MyBatis logging to the log4j2 API.

Signed-off-by: Nico Piel <nico.piel@hotmail.de>
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.

3 participants