Skip to content

Close JavaLogger file handlers - #3468

Merged
velo merged 1 commit into
OpenFeign:masterfrom
hutiefang76:codex/openfeign-2752-windows-tests
Jul 28, 2026
Merged

velo merged 1 commit into
OpenFeign:masterfrom
hutiefang76:codex/openfeign-2752-windows-tests

Conversation

@hutiefang76

Copy link
Copy Markdown
Contributor

Summary

This addresses the MultipleLoggerTest / JUL FileHandler part of #2752.

Logger.JavaLogger.appendToFile(...) adds FileHandler instances to the underlying JUL logger, but there was no supported way to close them. On Windows this can keep the temp log files locked until the JVM exits, which prevents JUnit from cleaning up @TempDir.

The change makes JavaLogger Closeable, tracks only the handlers added by that JavaLogger instance, and closes/removes those handlers from close(). The MultipleLoggerTest cases now close their loggers after checking handler setup.

Verification

  • RED: ./mvnw -pl core -Dtest=MultipleLoggerTest#javaLoggerClosesFileHandlers test -DskipITs -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true failed before the production change because JavaLogger.close() did not exist.
  • GREEN: ./mvnw -pl core -Dtest=MultipleLoggerTest test -DskipITs -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true passed, 4 tests.
  • GREEN: ./mvnw -pl core -Dtest=DefaultContractInheritanceTest,MultipleLoggerTest test -DskipITs -Dlicense.skip=true -Dcheckstyle.skip=true -Drat.skip=true passed, 13 tests.
  • GREEN: ./mvnw -pl core test -DskipITs -Dlicense.skip=true passed, 635 tests, 0 failures/errors, 3 skipped.
  • GREEN: ./mvnw -pl core git-code-format:validate-code-format -Dlicense.skip=true -DskipTests passed.
  • GREEN: git diff --check passed.

I did not change the DefaultContractInheritanceTest path in this PR; that looks like a separate reflection-order/generic bridge-method issue and is better handled independently.

Signed-off-by: hutiefang <hutiefang@qq.com>
@trumpetinc

Copy link
Copy Markdown
Collaborator

FYI - I have an easier fix for this issue: #3493

The reality is that closing log files while the application is running is not a normal thing, so I think the easy approach to just ignore the file deletion during test is appropriate.

@velo velo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved via agent-assisted review: change includes tests, no backwards-compatibility break, no security concerns, CI green.

@velo
velo merged commit 948eea2 into OpenFeign:master Jul 28, 2026
3 checks passed
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