How to tell duplicacy CLI where to store prune logs?

The logging behavior is inconsistent between back-up and prune commands.

Backup command seems to log to stdout. Prune command seems to create a file under .duplciacy/logs

Demo:

% mkdir source target && cd source
% duplicacy init test /tmp/target
/tmp/source will be backed up to /tmp/target with id test
% touch test

% duplicacy backup > backup.log
% duplicacy prune > prune.log

% cat backup.log
Storage set to /tmp/target
No previous backup found
Indexing /tmp/source
Parsing filter file /tmp/source/.duplicacy/filters
Loaded 0 include/exclude pattern(s)
Packed backup.log (160)
Packed test (0)
Backup for /tmp/source at revision 1 completed

% cat prune.log
Storage set to /tmp/target
No snapshot to delete

% ls .duplicacy/logs
prune-log-20210325-221855
  1. Ideally, there should be a key in preferences to specify log location.

  2. In the same vein, there should be key in preferences to specify cache location.

Impact: storing logs and transient caches along important files is rarely acceptable.

Everything under .duplicacy is discardable. If you want to move the logs (or the cache) to a different location, you should move .duplicacy instead (by using -repository when initializing the repository).

The prune logs have been proven to be very useful when there are missing chunks. Prune is the only operation that changes the existing storage so it deserves to be treated differently.

I don’t think this is accurate. For example, both preferences and filters files are located there. They are not discardable.

This is precisely what I do: on MacOS, the duplicacy is initialized under /Library/Duplicacy and repository points to /Users. The preferences and filter files located in /Library/Duplicacy/.duplicacy which is OK, however cache and logs subfolders need to go to /Library/Caches/Duplicacy and /Library/Logs/Duplicacy, as opposed to sub folders of /Library/Duplicacy/.duplicacy. Right now AFAIK it is not possible to accomplish (other than by creating symlinks)

Oh, absolutely. I’m all for keeping all sorts of logs. I just want a way to specify where the logs go (or for them to go to correct locations by default). Dumping everything in one pile is bad form; macOS designates special locations for logs and caches and well behaved apps shall follow the convention. Rclone for example does.

1 Like

Maybe inaccurate. The filters file is certainly not discardable, but you can move it out of the .duplicacy directory by using the -filters option of the set command. The preferences file can be easily reconstructed.

How about adding an option to the prune command to specify the log path?

1 Like

I guess that shall do it, and avoid customizing CLI code for each OS, albeit at the expense of each user having to specify more stuff in the command line instead.

Can we have the same for cache folder too?

1 Like

Sure. I think that option should go to the preferences file since it applies to multiple commands.

2 Likes