#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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
|
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 <noreply@anthropic.com>
|
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:
|
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