Example Brokk.ai-based fix of a bad logging dir on startup#5308
Example Brokk.ai-based fix of a bad logging dir on startup#5308
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| // | ||
| // Therefore: compute log path directly from homeDir, then call setupLogging(), | ||
| // THEN call handleLaunchArguments() which loads PathManager. | ||
| Path logPath = (homeDir != null ? homeDir : Paths.get(".")).resolve("logs"); |
There was a problem hiding this comment.
Log path wrong when homeDir is null
High Severity
When homeDir is null (the default for most users who don't pass --homedir), the fallback Paths.get(".") directs logs to the current working directory. Previously, setupLogging obtained the log path from PathManager.getInstance().getLogPath() after handleLaunchArguments() had called useDefaultHomePath(), which resolves to a platform-specific directory (e.g., ~/.local/share/terasology/logs on Linux). The new code cannot replicate that logic without loading PathManager, so it silently writes logs to the wrong location for the common no---homedir case.
There was a problem hiding this comment.
Good bot! I had wondered about this. Would you recommend a fix or is this a tricky case?


Contains
I'm playing with brokk.ai and this is solely a test of a simple bug fix - just getting commits off my test system to see them in a different light. 100% AI including commit after each edit as that's how Brokk does it. Need to look at this with less sleepy eyes to see if it makes sense then tidy up further if so :-)
How to test
When running Terasology from source without this fix you get a badly named logs folder as logging initializes before the folder name is available. Running Terasology with this fix (and that folder from a prior execution deleted) the bad folder should not show up.
Outstanding before merging
Note
Low Risk
Small, localized change to startup/log initialization ordering plus repo hygiene files; low risk aside from potential differences in early log location resolution when
--homediris used.Overview
Fixes a startup ordering issue where Logback could initialize before
LoggingContext.initialize(), creating alogFileFolder_IS_UNDEFINEDlogs directory.Terasology.call()now computes the log directory directly from--homedir(or.) and initializes logging beforehandleLaunchArguments()loadsPathManager;setupLogging()is updated to accept an explicitPath, and earlyhomeDirdiagnostics switch from SLF4J toSystem.out.Also adds Brokk-related ignores under
.brokk/and checks in anAGENTS.mdstyle guide file.Written by Cursor Bugbot for commit 8e6a3e6. This will update automatically on new commits. Configure here.