Increase logging around file removal events
authorFelix Weilbach <felix.weilbach@nextcloud.com>
Fri, 19 Mar 2021 09:40:26 +0000 (10:40 +0100)
committerFelix Weilbach (Rebase PR Action) <felix.weilbach@t-online.de>
Mon, 22 Mar 2021 07:48:39 +0000 (07:48 +0000)
To better see what is going on when and if files are removed by the
client.

See also: #260, #1433, #2913

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
src/libsync/discovery.cpp
src/libsync/propagateremotedelete.cpp
src/libsync/propagatorjobs.cpp

index 95cb7bf348de10b4e50c231af4e0c411af51f02f..edded199a7373f40732ba21f41a184cad4d1070b 100644 (file)
@@ -715,6 +715,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
             // Not modified locally (ParentNotChanged)
             if (noServerEntry) {
                 // not on the server: Removed on the server, delete locally
+                qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
                 item->_instruction = CSYNC_INSTRUCTION_REMOVE;
                 item->_direction = SyncFileItem::Down;
             } else if (dbEntry._type == ItemTypeVirtualFileDehydration) {
@@ -739,6 +740,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
         } else if (!serverModified) {
             // Removed locally: also remove on the server.
             if (!dbEntry._serverHasIgnoredFiles) {
+                qCInfo(lcDisco) << "File" << item->_file << "was deleted locally. Going to delete it on the server.";
                 item->_instruction = CSYNC_INSTRUCTION_REMOVE;
                 item->_direction = SyncFileItem::Up;
             }
@@ -777,6 +779,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
         } else if (!typeChange && ((dbEntry._modtime == localEntry.modtime && dbEntry._fileSize == localEntry.size) || localEntry.isDirectory)) {
             // Local file unchanged.
             if (noServerEntry) {
+                qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally.";
                 item->_instruction = CSYNC_INSTRUCTION_REMOVE;
                 item->_direction = SyncFileItem::Down;
             } else if (dbEntry._type == ItemTypeVirtualFileDehydration || localEntry.type == ItemTypeVirtualFileDehydration) {
index 26073e7bc28a36b4e4ecbddd2abd0f193df5bde4..5006ff4329f8533180a24fe849badeab7cffa646 100644 (file)
@@ -28,6 +28,8 @@ Q_LOGGING_CATEGORY(lcPropagateRemoteDelete, "nextcloud.sync.propagator.remotedel
 
 void PropagateRemoteDelete::start()
 {
+    qCInfo(lcPropagateRemoteDelete) << "Start propagate remote delete job for" << _item->_file;
+
     if (propagator()->_abortRequested)
         return;
 
index b286c15040e9b64d1ae28a870f52737571bba5d6..469e966000979d63f5f36892886922b6ef997cc0 100644 (file)
@@ -89,13 +89,15 @@ bool PropagateLocalRemove::removeRecursively(const QString &path)
 
 void PropagateLocalRemove::start()
 {
+    qCInfo(lcPropagateLocalRemove) << "Start propagate local remove job";
+
     _moveToTrash = propagator()->syncOptions()._moveFilesToTrash;
 
     if (propagator()->_abortRequested)
         return;
 
     const QString filename = propagator()->fullLocalPath(_item->_file);
-    qCDebug(lcPropagateLocalRemove) << filename;
+    qCInfo(lcPropagateLocalRemove) << "Going to delete:" << filename;
 
     if (propagator()->localFileNameClash(_item->_file)) {
         done(SyncFileItem::NormalError, tr("Could not remove %1 because of a local file name clash").arg(QDir::toNativeSeparators(filename)));