WIP: Fix duplicate logging#122
Conversation
SummaryProblem: File logging was being enabled multiple times, causing duplicate log entries. Solution: Moved Changes: Affected 4 commands:
Also made What reviewers should knowReview focus:
Pattern: All four commands follow the same refactor pattern—this is consistent and intentional, not a mistake.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit ad818c9. Configure here.
| ...(options.maxMemory && { maxMemoryMB: options.maxMemory }), | ||
| }); | ||
| ensureHeapSize(perfConfig.maxMemoryMB); | ||
| enableFileLogging('transfer'); |
There was a problem hiding this comment.
File logging enabled after early log messages and error-prone steps
Medium Severity
Moving enableFileLogging from the index files into the handler functions means it now runs after several logger.info calls and error-prone operations like config loading. In handle-transfer-action.js, two banner messages on lines 20–21 are emitted before enableFileLogging on line 33, so they won't appear in file logs. Similarly, banner messages in each command's index.js (e.g., '=== CloudVoyager - Full Organization Migration ===') are now logged before the handler even calls enableFileLogging. Worse, if config loading or ensureHeapSize throws, enableFileLogging is never reached, so the error logged by handleCommandError in the catch block won't be captured in any log file.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit ad818c9. Configure here.


Note
Low Risk
Low risk: moves
enableFileLoggingcalls from command entrypoints into the underlying action handlers; main impact is log file initialization timing/naming formigrate,transfer,sync-metadata, andverify. Potential risk is only around unexpected logger transport state or log file paths if handlers are invoked in new ways.Overview
Fixes duplicate/early log file setup by moving
enableFileLogging()out of CLI command.action()blocks and into the correspondinghandle*Actionfunctions formigrate,transfer,sync-metadata, andverify.Each action now enables file logging with a command-specific name (e.g.
migrate,transfer,verify) just beforelogSystemInfo(), so file transports are configured once per run and after heap sizing is applied.Reviewed by Cursor Bugbot for commit ad818c9. Bugbot is set up for automated code reviews on this repo. Configure here.