Repository navigation
#3732 fix: DefaultLogger no longer creates ./log when no FileHandler is configured - #3734
Conversation
…figured Fixes #3732. Previously DefaultLogger.init() hardcoded creation of the ./log directory at every startup, printing an error when not writable even if the user had configured console-only logging. The fix peeks at the pending log configuration, finds the FileHandler.pattern (if any), and pre-creates only that directory — nothing is created when no FileHandler is configured. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Code ReviewGood fix for issue #3732 — the approach of peeking at the configuration before loading it is sound and the three-location fallback chain mirrors Bug:
|
There was a problem hiding this comment.
Code Review
This pull request resolves issue #3732 by modifying the DefaultLogger to prevent the unconditional creation of a ./log directory. The init() method has been refactored to dynamically determine and pre-create the log directory only if a java.util.logging.FileHandler.pattern is explicitly configured, resolving issues with unwritable paths and custom logging setups. New helper methods were introduced to parse the logging configuration before full initialization. Two regression tests have been added to validate both scenarios: no directory creation for console-only configurations and correct directory creation for file-based logging. The only feedback is to improve the exception handling in createLogDirectoryFromConfig by logging the caught exception instead of silently ignoring it, to aid in debugging.
- Fix %% escape ordering: use a null-char placeholder so that %%t is not erroneously expanded to <tmpdir> by the %t substitution - Import java.util.Properties instead of using the fully-qualified name - Switch classpath InputStream to try-with-resources for consistency - Log the caught exception message in createLogDirectoryFromConfig - Strengthen regression test: assert ./log was not created (not just that FileHandler.pattern is absent from LogManager) - Remove tracking doc from repository root Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Addressed all review feedback in the follow-up commit:
|
Code Review:
|
- Add logDirectoryCreatedWithTmpDirSubstitution test: verifies %t (java.io.tmpdir) is correctly resolved when pre-creating the log directory - Clarify inline that java.util.logging.LogManager and java.util.logging.Logger must remain fully-qualified due to naming conflict with com.arcadedb.log.* imports required by the existing customLogger() test (Java has no import aliases) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Added Regarding the fully-qualified |
Code ReviewGood fix for issue #3732. The approach of peeking at configuration before loading it into What Looks Good
Issues to AddressMedium:
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3734 +/- ##
=======================================
Coverage 64.56% 64.56%
=======================================
Files 1580 1580
Lines 115374 115414 +40
Branches 24426 24432 +6
=======================================
+ Hits 74488 74518 +30
Misses 30733 30733
- Partials 10153 10163 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…[skip ci] Bumps [org.mockito:mockito-core](https://github.com/mockito/mockito) from 5.20.0 to 5.21.0. Release notes *Sourced from [org.mockito:mockito-core's releases](https://github.com/mockito/mockito/releases).* > v5.21.0 > ------- > > *Changelog generated by [Shipkit Changelog Gradle Plugin](https://github.com/shipkit/shipkit-changelog)* > > #### 5.21.0 > > * 2025-12-09 - [17 commit(s)](mockito/mockito@v5.20.0...v5.21.0) by Giulio Longfils, Joshua Selbo, Woongi9, Zylox, dependabot[bot] > * Bump graalvm/setup-graalvm from 1.4.3 to 1.4.4 [([ArcadeData#3768](https://redirect.github.com/mockito/mockito/issues/3768))]([mockito/mockito#3768](https://redirect.github.com/mockito/mockito/pull/3768)) > * Bump graalvm/setup-graalvm from 1.4.2 to 1.4.3 [([ArcadeData#3767](https://redirect.github.com/mockito/mockito/issues/3767))]([mockito/mockito#3767](https://redirect.github.com/mockito/mockito/pull/3767)) > * Bump actions/checkout from 5 to 6 [([ArcadeData#3765](https://redirect.github.com/mockito/mockito/issues/3765))]([mockito/mockito#3765](https://redirect.github.com/mockito/mockito/pull/3765)) > * Adds output of matchers to potential mismatch; Fixes [ArcadeData#2468](https://redirect.github.com/mockito/mockito/issues/2468) [([ArcadeData#3760](https://redirect.github.com/mockito/mockito/issues/3760))]([mockito/mockito#3760](https://redirect.github.com/mockito/mockito/pull/3760)) > * Forbid mocking WeakReference with inline mock maker [([ArcadeData#3759](https://redirect.github.com/mockito/mockito/issues/3759))]([mockito/mockito#3759](https://redirect.github.com/mockito/mockito/pull/3759)) > * StackOverflowError when mocking WeakReference [([ArcadeData#3758](https://redirect.github.com/mockito/mockito/issues/3758))]([mockito/mockito#3758](https://redirect.github.com/mockito/mockito/issues/3758)) > * Bump actions/upload-artifact from 4 to 5 [([ArcadeData#3756](https://redirect.github.com/mockito/mockito/issues/3756))]([mockito/mockito#3756](https://redirect.github.com/mockito/mockito/pull/3756)) > * Bump graalvm/setup-graalvm from 1.4.1 to 1.4.2 [([ArcadeData#3755](https://redirect.github.com/mockito/mockito/issues/3755))]([mockito/mockito#3755](https://redirect.github.com/mockito/mockito/pull/3755)) > * Support primitives in GenericArrayReturnType. [([ArcadeData#3753](https://redirect.github.com/mockito/mockito/issues/3753))]([mockito/mockito#3753](https://redirect.github.com/mockito/mockito/pull/3753)) > * ClassNotFoundException when stubbing array of primitive type on Android [([ArcadeData#3752](https://redirect.github.com/mockito/mockito/issues/3752))]([mockito/mockito#3752](https://redirect.github.com/mockito/mockito/issues/3752)) > * Bump graalvm/setup-graalvm from 1.4.0 to 1.4.1 [([ArcadeData#3744](https://redirect.github.com/mockito/mockito/issues/3744))]([mockito/mockito#3744](https://redirect.github.com/mockito/mockito/pull/3744)) > * Bump gradle/actions from 4 to 5 [([ArcadeData#3743](https://redirect.github.com/mockito/mockito/issues/3743))]([mockito/mockito#3743](https://redirect.github.com/mockito/mockito/pull/3743)) > * Bump org.graalvm.buildtools.native from 0.11.0 to 0.11.1 [([ArcadeData#3738](https://redirect.github.com/mockito/mockito/issues/3738))]([mockito/mockito#3738](https://redirect.github.com/mockito/mockito/pull/3738)) > * Bump com.diffplug.spotless:spotless-plugin-gradle from 7.2.1 to 8.0.0 [([ArcadeData#3735](https://redirect.github.com/mockito/mockito/issues/3735))]([mockito/mockito#3735](https://redirect.github.com/mockito/mockito/pull/3735)) > * Bump graalvm/setup-graalvm from 1.3.7 to 1.4.0 [([ArcadeData#3734](https://redirect.github.com/mockito/mockito/issues/3734))]([mockito/mockito#3734](https://redirect.github.com/mockito/mockito/pull/3734)) > * Bump org.assertj:assertj-core from 3.27.5 to 3.27.6 [([ArcadeData#3733](https://redirect.github.com/mockito/mockito/issues/3733))]([mockito/mockito#3733](https://redirect.github.com/mockito/mockito/pull/3733)) > * Bump errorprone from 2.41.0 to 2.42.0 [([ArcadeData#3732](https://redirect.github.com/mockito/mockito/issues/3732))]([mockito/mockito#3732](https://redirect.github.com/mockito/mockito/pull/3732)) > * Feat: automatically detect class to mock in mockStatic and mockConstruction [([ArcadeData#3731](https://redirect.github.com/mockito/mockito/issues/3731))]([mockito/mockito#3731](https://redirect.github.com/mockito/mockito/pull/3731)) > * Return completed futures for unstubbed Future/CompletionStage in ReturnsEmptyValues [([ArcadeData#3727](https://redirect.github.com/mockito/mockito/issues/3727))]([mockito/mockito#3727](https://redirect.github.com/mockito/mockito/pull/3727)) > * automatically detect class to mock [([ArcadeData#2779](https://redirect.github.com/mockito/mockito/issues/2779))]([mockito/mockito#2779](https://redirect.github.com/mockito/mockito/pull/2779)) > * Incorrect "has following stubbing(s) with different arguments" message when using Argument Matchers [([ArcadeData#2468](https://redirect.github.com/mockito/mockito/issues/2468))]([mockito/mockito#2468](https://redirect.github.com/mockito/mockito/issues/2468)) Commits * [`09d2230`](mockito/mockito@09d2230) Bump graalvm/setup-graalvm from 1.4.3 to 1.4.4 ([ArcadeData#3768](https://redirect.github.com/mockito/mockito/issues/3768)) * [`df3e0cc`](mockito/mockito@df3e0cc) Bump graalvm/setup-graalvm from 1.4.2 to 1.4.3 ([ArcadeData#3767](https://redirect.github.com/mockito/mockito/issues/3767)) * [`04a6e9f`](mockito/mockito@04a6e9f) Bump actions/checkout from 5 to 6 ([ArcadeData#3765](https://redirect.github.com/mockito/mockito/issues/3765)) * [`756a3cf`](mockito/mockito@756a3cf) Add description of matchers to potential mismatch ([ArcadeData#3760](https://redirect.github.com/mockito/mockito/issues/3760)) * [`58ba445`](mockito/mockito@58ba445) Forbid mocking WeakReference with inline mock maker ([ArcadeData#3759](https://redirect.github.com/mockito/mockito/issues/3759)) * [`966d600`](mockito/mockito@966d600) Bump actions/upload-artifact from 4 to 5 ([ArcadeData#3756](https://redirect.github.com/mockito/mockito/issues/3756)) * [`632bf7b`](mockito/mockito@632bf7b) Bump graalvm/setup-graalvm from 1.4.1 to 1.4.2 ([ArcadeData#3755](https://redirect.github.com/mockito/mockito/issues/3755)) * [`8564b43`](mockito/mockito@8564b43) Fix primitives support in GenericArrayReturnType for Android ([ArcadeData#3753](https://redirect.github.com/mockito/mockito/issues/3753)) * [`bf3a809`](mockito/mockito@bf3a809) Bump graalvm/setup-graalvm from 1.4.0 to 1.4.1 ([ArcadeData#3744](https://redirect.github.com/mockito/mockito/issues/3744)) * [`cffddd4`](mockito/mockito@cffddd4) Bump gradle/actions from 4 to 5 ([ArcadeData#3743](https://redirect.github.com/mockito/mockito/issues/3743)) * Additional commits viewable in [compare view](mockito/mockito@v5.20.0...v5.21.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
…leHandler is configured (ArcadeData#3734)
Summary
DefaultLogger.init()was unconditionally creating./logat startup regardless of logging configuration, producing a spuriousCannot create log directory: /./logerror when the path wasn't writablejava.util.logging.FileHandler.pattern(without loading it into the LogManager), pre-creates only that directory, then loads the config — no directory is created when no FileHandler is configuredTest plan
LoggerTest#noLogDirectoryCreatedWithConsoleOnlyConfig— console-only config → noFileHandler.patternregistered, no spurious directory creationLoggerTest#logDirectoryCreatedFromConfiguredFileHandlerPattern— customFileHandler.patternpointing to a temp dir → that dir is created before config is loadedLoggerTest#customLogger— existing test still passesAll 3 tests pass (
mvn test -pl engine -Dtest=LoggerTest).🤖 Generated with Claude Code