Skip to content

fix: enable in-app sync logging (log2File init, INFO/NOTICE capture, log-level conflict)#411

Open
7MS8 wants to merge 3 commits into
newhinton:masterfrom
7MS8:fix/sync-logging-improvements
Open

fix: enable in-app sync logging (log2File init, INFO/NOTICE capture, log-level conflict)#411
7MS8 wants to merge 3 commits into
newhinton:masterfrom
7MS8:fix/sync-logging-improvements

Conversation

@7MS8

@7MS8 7MS8 commented Jul 8, 2026

Copy link
Copy Markdown

Split out of #406 per reviewer request (separate unrelated fixes into their own PRs). This bundles the sync-logging pipeline fixes together since they're one coherent feature evolution — splitting the log-level fix out on its own would leave an intermediate state that crashes (see below), which is the same pattern the reviewer already flagged for the SFTP PR.

Bugs

  1. log2File never initialized. log2File: Log2File? = null in SyncWorker.kt/EphemeralWorker.kt was declared but never assigned, so log2File?.log() was always a no-op even with "Use Logs" enabled — logs/log.txt stayed empty. Also added a null guard in Log2File for getExternalFilesDir() returning null (observed on GrapheneOS).
  2. rclone ran at default log level, so INFO messages (per-file operations, "There was nothing to transfer") never reached the in-app sync log — only NOTICE-level summary stats. Added --log-level INFO and collected INFO lines into the sync log entry.
  3. (1)+(2) combined caused a silent crash: adding --log-level INFO unconditionally conflicts with -vvv (added when debug logging is enabled) — rclone exits immediately with Can't set -v and --log-level, and the sync silently does nothing. Fixed by only adding --log-level/--stats-log-level when verbose logging is off.
  4. Also captured NOTICE-level output (transfer stats) alongside INFO messages in the same sync log entry, since transfer stats were previously dropped from the in-app log entirely.

Reproduction

  • Enable "Use Logs" in settings and run any sync.
  • Before this fix: logs/log.txt stays empty regardless of sync outcome; the in-app sync log entry contains no per-file detail; if debug logging is on, sync fails silently with no useful log output at all (the -vvv/--log-level crash).
  • After this fix: logs/log.txt is populated for error-level rclone output, the sync log entry includes per-file INFO lines plus a final NOTICE transfer-stats line, and sync no longer crashes when debug logging is enabled.

Test plan

  • Local build compiles (./gradlew :app:compileOssDebugSources).
  • Run a sync with "Use Logs" enabled and confirm the in-app sync log shows per-file detail + transfer stats, and logs/log.txt captures error-level output.

michael and others added 3 commits July 8, 2026 19:04
log2File was declared but never assigned, so log2File?.log() was always
a no-op even when logging was enabled. Initialize it in doWork() when
logging is enabled. Also add null guard in Log2File for cases where
getExternalFilesDir() returns null (e.g. on GrapheneOS).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rclone was running at default log level (WARNING), so INFO messages
like per-file operations and "There was nothing to transfer" were
never visible. Added --log-level INFO to sync command and collect
rclone INFO lines into a single SyncLog entry per sync run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
--log-level INFO was always added, but conflicts with -vvv (added
when debug logging is enabled), causing rclone to exit immediately
with "Can't set -v and --log-level" -- the sync silently does
nothing. Only add --log-level/--stats-log-level when verbose
logging is off.

Also capture NOTICE-level rclone output (transfer stats) and
include it alongside INFO messages in the in-app sync log entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@scr4bble

Copy link
Copy Markdown

This is another very useful fix. As described in issue #407, filesystem permission errors caused rclone to skip remote deletions, while Round Sync reported “There was nothing to do” and did not expose the underlying errors.

I have not tested this PR yet, but I can confirm the logging bug, as I encountered it while investigating #407. My PR #414 fixes the task result and notification handling and persists relevant warning/error lines. This PR complements it by fixing the separate rclone log explicitly enabled in the app settings, including its initialization and INFO/NOTICE capture.

There is some overlap in SyncWorker, so the changes may need to be reconciled, but together the two PRs appear to fully address the issue described in #407.

@scr4bble scr4bble mentioned this pull request Jul 10, 2026
1 task
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.

2 participants