From 919d9a087b312566efdaca1ef13823180a20bab6 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Fri, 9 Feb 2024 20:48:44 +0100 Subject: [PATCH] Add logs. Signed-off-by: Camila Ayres --- src/gui/accountsettings.cpp | 6 +++++- src/gui/application.cpp | 1 + src/gui/connectionvalidator.cpp | 2 ++ src/gui/folder.cpp | 2 ++ src/gui/folderman.cpp | 6 +++++- src/gui/owncloudgui.cpp | 1 + src/gui/systray.cpp | 2 ++ src/gui/tray/usermodel.cpp | 3 +++ src/libsync/discovery.cpp | 2 ++ src/libsync/discoveryphase.cpp | 7 +++++++ src/libsync/networkjobs.cpp | 6 ++++-- src/libsync/propagateremotemkdir.cpp | 1 + src/libsync/syncengine.cpp | 1 + 13 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index 719f85704f8d4..761a2403331bc 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -672,6 +672,7 @@ void AccountSettings::slotCustomContextMenuRequested(const QPoint &pos) if (!folderPaused) { ac = menu->addAction(tr("Force sync now")); if (folder && folder->isSyncRunning()) { + qCWarning(lcAccountSettings) << "=> Restart syncing for" << selectedFolderAlias(); ac->setText(tr("Restart sync")); } ac->setEnabled(folderConnected); @@ -1139,6 +1140,7 @@ void AccountSettings::showConnectionLabel(const QString &message, QStringList er void AccountSettings::slotEnableCurrentFolder(bool terminate) { + qCWarning(lcAccountSettings) << "=> User!! resuming or pausing sync: terminate value is" << terminate; const auto alias = selectedFolderAlias(); if (!alias.isEmpty()) { @@ -1195,8 +1197,9 @@ void AccountSettings::slotScheduleCurrentFolder() void AccountSettings::slotScheduleCurrentFolderForceRemoteDiscovery() { - const auto folderMan = FolderMan::instance(); + const auto folderMan = FolderMan::instance(); if (auto folder = folderMan->folder(selectedFolderAlias())) { + qCWarning(lcAccountSettings) << "=> Schedule current folder" << selectedFolderAlias() << "RemoteDiscovery"; folder->slotWipeErrorBlacklist(); folder->journalDb()->forceRemoteDiscoveryNextSync(); folderMan->scheduleFolder(folder); @@ -1207,6 +1210,7 @@ void AccountSettings::slotForceSyncCurrentFolder() { FolderMan *folderMan = FolderMan::instance(); auto selectedFolder = folderMan->folder(selectedFolderAlias()); + qCWarning(lcAccountSettings) << "=> Force syncing for" << selectedFolderAlias(); folderMan->forceSyncForFolder(selectedFolder); } diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 48fb06682f109..b2963e45f1b77 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -598,6 +598,7 @@ void Application::slotAccountStateAdded(AccountState *accountState) void Application::slotCleanup() { + qCWarning(lcApplication) << "=> User!! Application is about to quite/close!!"; AccountManager::instance()->save(); FolderMan::instance()->unloadAndDeleteAllFolders(); diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp index 9cc24de4a7521..12efa80ca89fc 100644 --- a/src/gui/connectionvalidator.cpp +++ b/src/gui/connectionvalidator.cpp @@ -207,6 +207,8 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply) auto job = qobject_cast(sender()); Status stat = Timeout; + qCWarning(lcConnectionValidator) << "=> reply->error():" << reply->error() << "- job->errorString():" << job->errorString(); + if (reply->error() == QNetworkReply::SslHandshakeFailedError) { _errors << job->errorStringParsingBody(); stat = SslError; diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 7b42535f22d8f..3eaabaa12d301 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -361,6 +361,8 @@ void Folder::etagRetrieved(const QByteArray &etag, const QDateTime &tp) { // re-enable sync if it was disabled because network was down FolderMan::instance()->setSyncEnabled(true); + qCInfo(lcFolder) << "=> Etag retrieved: last:" << _lastEtag << ", received:" << etag; + qCInfo(lcFolder) << "=> For folder:" << _canonicalLocalPath; if (_lastEtag != etag) { qCInfo(lcFolder) << "Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED"; diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index ffced3a51ccc0..46ee9e5cb9fcf 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -654,6 +654,7 @@ void FolderMan::forceSyncForFolder(Folder *folder) // Terminate and reschedule any running sync for (const auto folderInMap : map()) { if (folderInMap->isSyncRunning()) { + qCWarning(lcFolderMan) << "=> User!! Terminating syncing for" << folderInMap->path(); folderInMap->slotTerminateSync(); scheduleFolder(folderInMap); } @@ -679,7 +680,7 @@ void FolderMan::removeE2eFiles(const AccountPtr &account) const void FolderMan::slotScheduleAppRestart() { _appRestartRequired = true; - qCInfo(lcFolderMan) << "Application restart requested!"; + qCInfo(lcFolderMan) << "=> Application restart requested!"; } void FolderMan::slotSyncOnceFileUnlocks(const QString &path) @@ -1339,6 +1340,7 @@ void FolderMan::removeFolder(Folder *f) const bool currentlyRunning = f->isSyncRunning(); if (currentlyRunning) { // abort the sync now + qCWarning(lcFolderMan) << "=> User?? Abort syncing for" << f->path(); f->slotTerminateSync(); } @@ -1929,6 +1931,8 @@ Folder *FolderMan::currentSyncFolder() const void FolderMan::restartApplication() { + qCInfo(lcFolderMan) << "Restarting application NOW!!"; + if (Utility::isLinux()) { // restart: qCInfo(lcFolderMan) << "Restarting application NOW, PID" << qApp->applicationPid() << "is ending."; diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index c14b5125a0861..5e095ddb7f9ba 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -600,6 +600,7 @@ void ownCloudGui::slotShutdown() { // explicitly close windows. This is somewhat of a hack to ensure // that saving the geometries happens ASAP during a OS shutdown + qCWarning(lcApplication) << "=> Shutting down!!"; // those do delete on close if (!_settingsDialog.isNull()) diff --git a/src/gui/systray.cpp b/src/gui/systray.cpp index fb8451aa4c7b8..5054c20593ea7 100644 --- a/src/gui/systray.cpp +++ b/src/gui/systray.cpp @@ -442,11 +442,13 @@ void Systray::slotCurrentUserChanged() void Systray::slotUnpauseAllFolders() { + qCWarning(lcSystray) << "=> User!! Resume/unpause syncing all folders!!"; setPauseOnAllFoldersHelper(false); } void Systray::slotPauseAllFolders() { + qCWarning(lcSystray) << "=> User!! Pause syncing all folders!!"; setPauseOnAllFoldersHelper(true); } diff --git a/src/gui/tray/usermodel.cpp b/src/gui/tray/usermodel.cpp index da175d3e28bf8..830b59887a15f 100644 --- a/src/gui/tray/usermodel.cpp +++ b/src/gui/tray/usermodel.cpp @@ -36,6 +36,8 @@ constexpr qint64 activityDefaultExpirationTimeMsecs = 1000 * 60 * 10; } namespace OCC { + +Q_LOGGING_CATEGORY(lcUserModel, "nextcloud.gui.usermodel", QtInfoMsg) TrayFolderInfo::TrayFolderInfo(const QString &name, const QString &parentPath, const QString &fullPath, FolderType folderType) : _name(name) @@ -1098,6 +1100,7 @@ void User::slotSendReplyMessage(const int activityIndex, const QString &token, c void User::forceSyncNow() const { + qCWarning(lcUserModel) << "=> Force sync now for" << getFolder()->path(); FolderMan::instance()->forceSyncForFolder(getFolder()); } diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index ef0644ca14260..3c857cc489871 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -2109,6 +2109,8 @@ void ProcessDirectoryJob::startAsyncLocalQuery() QString localPath = _discoveryData->_localDir + _currentFolder._local; auto localJob = new DiscoverySingleLocalDirectoryJob(_discoveryData->_account, localPath, _discoveryData->_syncOptions._vfs.data()); + qCWarning(lcDisco) << "=> ProcessDirectoryJob::startAsyncLocalQuery: localPath:" << localPath; + _discoveryData->_currentlyActiveJobs++; _pendingAsyncJobs++; diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 33516635d9384..d74b31a33dda4 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -80,6 +80,7 @@ void DiscoveryPhase::checkFolderSizeLimit(const QString &path, const std::functi << "http://owncloud.org/ns:size"); connect(propfindJob, &PropfindJob::finishedWithError, this, [=] { + qCWarning(lcDiscovery) << "=> propfindJob->reply()->error():" << propfindJob->reply()->error() << "- propfindJob->reply()->errorString():" << propfindJob->reply()->errorString(); return completionCallback(false); }); connect(propfindJob, &PropfindJob::result, this, [=](const QVariantMap &values) { @@ -228,8 +229,10 @@ void DiscoveryPhase::enqueueDirectoryToDelete(const QString &path, ProcessDirect void DiscoveryPhase::startJob(ProcessDirectoryJob *job) { ENFORCE(!_currentRootJob); + qCWarning(lcDiscovery) << "=> DiscoveryPhase::startJob for:" << job->_dirItem; connect(this, &DiscoveryPhase::itemDiscovered, this, &DiscoveryPhase::slotItemDiscovered, Qt::UniqueConnection); connect(job, &ProcessDirectoryJob::finished, this, [this, job] { + qCWarning(lcDiscovery) << "=> ProcessDirectoryJob::finished for" << job->_dirItem; ENFORCE(_currentRootJob == sender()); _currentRootJob = nullptr; if (job->_dirItem) @@ -276,6 +279,10 @@ void DiscoveryPhase::scheduleMoreJobs() void DiscoveryPhase::slotItemDiscovered(const OCC::SyncFileItemPtr &item) { + qCWarning(lcDiscovery) << "=> DiscoveryPhase::slotItemDiscovered:" + << "| item->_file:" << item->_file + << "| item->_direction:" << item->_direction + << "| item->_instruction:" << item->_instruction; if (item->_instruction == CSYNC_INSTRUCTION_ERROR && item->_direction == SyncFileItem::Up) { _hasUploadErrorItems = true; } diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 700afb41741f5..a57423068ee49 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -669,6 +669,7 @@ bool PropfindJob::finished() if (!domDocument.setContent(reply(), true, &errorMsg, &errorLine, &errorColumn)) { qCWarning(lcPropfindJob) << "XML parser error: " << errorMsg << errorLine << errorColumn; + qCWarning(lcPropfindJob) << "=> reply()->error():" << reply()->error() << "- reply()->errorString():" << reply()->errorString(); emit finishedWithError(reply()); } else { @@ -679,6 +680,7 @@ bool PropfindJob::finished() } else { qCWarning(lcPropfindJob) << "*not* successful, http result code is" << http_result_code << (http_result_code == 302 ? reply()->header(QNetworkRequest::LocationHeader).toString() : QLatin1String("")); + qCWarning(lcPropfindJob) << "=> reply()->error():" << reply()->error() << "- reply()->errorString():" << reply()->errorString(); emit finishedWithError(reply()); } @@ -1270,8 +1272,8 @@ void fetchPrivateLinkUrl(AccountPtr account, const QString &remotePath, targetFun(oldUrl); } }); - QObject::connect(job, &PropfindJob::finishedWithError, target, [=](QNetworkReply *) { - targetFun(oldUrl); + QObject::connect(job, &PropfindJob::finishedWithError, target, [=](QNetworkReply * reply) { + qCWarning(lcPropfindJob) << "=> reply->error():" << reply->error() << "- job->errorString():" << job->errorString(); }); job->start(); } diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index e301beed5a723..e03daf7a2171f 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/src/libsync/propagateremotemkdir.cpp @@ -175,6 +175,7 @@ void PropagateRemoteMkdir::finalizeMkColJob(QNetworkReply::NetworkError err, con }); connect(propfindJob, &PropfindJob::finishedWithError, this, [this] (QNetworkReply *reply) { const auto err = reply ? reply->error() : QNetworkReply::NetworkError::UnknownNetworkError; + qCWarning(lcPropagateRemoteMkdir) << "=> reply->error():" << reply->error() << "- propfindJob->errorString():" << reply->errorString(); propagator()->_activeJobList.removeOne(this); done(SyncFileItem::NormalError, {}, errorCategoryFromNetworkError(err)); }); diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index e25ea716d2255..54200a0ffd437 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -679,6 +679,7 @@ void SyncEngine::startSync() connect(_discoveryPhase.data(), &DiscoveryPhase::existingFolderNowBig, this, &SyncEngine::existingFolderNowBig); connect(_discoveryPhase.data(), &DiscoveryPhase::fatalError, this, [this](const QString &errorString, ErrorCategory errorCategory) { Q_EMIT syncError(errorString, errorCategory); + qCWarning(lcEngine) << "=> SyncEngine DiscoveryPhase::fatalError emitted:" << errorString; finalize(false); }); connect(_discoveryPhase.data(), &DiscoveryPhase::finished, this, &SyncEngine::slotDiscoveryFinished);