diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp index b3807c3ce6..1c1ab17548 100644 --- a/src/gui/accountmanager.cpp +++ b/src/gui/accountmanager.cpp @@ -49,7 +49,7 @@ bool AccountManager::restore() { auto settings = Utility::settingsWithGroup(QLatin1String(accountsC)); if (settings->status() != QSettings::NoError) { - qCDebug(lcAccountManager) << "Could not read settings from" << settings->fileName() + qCWarning(lcAccountManager) << "Could not read settings from" << settings->fileName() << settings->status(); return false; } @@ -77,7 +77,7 @@ bool AccountManager::restore() bool AccountManager::restoreFromLegacySettings() { - qCDebug(lcAccountManager) << "Migrate: restoreFromLegacySettings, checking settings group" + qCInfo(lcAccountManager) << "Migrate: restoreFromLegacySettings, checking settings group" << Theme::instance()->appName(); // try to open the correctly themed settings @@ -93,7 +93,7 @@ bool AccountManager::restoreFromLegacySettings() oCCfgFile = oCCfgFile.left( oCCfgFile.lastIndexOf('/')); oCCfgFile += QLatin1String("/ownCloud/owncloud.cfg"); - qCDebug(lcAccountManager) << "Migrate: checking old config " << oCCfgFile; + qCInfo(lcAccountManager) << "Migrate: checking old config " << oCCfgFile; QFileInfo fi( oCCfgFile ); if( fi.isReadable() ) { @@ -109,7 +109,7 @@ bool AccountManager::restoreFromLegacySettings() // in case the urls are equal reset the settings object to read from // the ownCloud settings object - qCDebug(lcAccountManager) << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":" + qCInfo(lcAccountManager) << "Migrate oC config if " << oCUrl << " == " << overrideUrl << ":" << (oCUrl == overrideUrl ? "Yes" : "No"); if( oCUrl == overrideUrl ) { settings = std::move(oCSettings); @@ -140,31 +140,31 @@ void AccountManager::save(bool saveCredentials) } settings->sync(); - qCDebug(lcAccountManager) << "Saved all account settings, status:" << settings->status(); + qCInfo(lcAccountManager) << "Saved all account settings, status:" << settings->status(); } void AccountManager::saveAccount(Account* a) { - qCDebug(lcAccountManager) << "Saving account" << a->url().toString(); + qCInfo(lcAccountManager) << "Saving account" << a->url().toString(); auto settings = Utility::settingsWithGroup(QLatin1String(accountsC)); settings->beginGroup(a->id()); saveAccountHelper(a, *settings, false); // don't save credentials they might not have been loaded yet settings->endGroup(); settings->sync(); - qCDebug(lcAccountManager) << "Saved account settings, status:" << settings->status(); + qCInfo(lcAccountManager) << "Saved account settings, status:" << settings->status(); } void AccountManager::saveAccountState(AccountState* a) { - qCDebug(lcAccountManager) << "Saving account state" << a->account()->url().toString(); + qCInfo(lcAccountManager) << "Saving account state" << a->account()->url().toString(); auto settings = Utility::settingsWithGroup(QLatin1String(accountsC)); settings->beginGroup(a->account()->id()); a->writeToSettings(*settings); settings->endGroup(); settings->sync(); - qCDebug(lcAccountManager) << "Saved account state settings, status:" << settings->status(); + qCInfo(lcAccountManager) << "Saved account state settings, status:" << settings->status(); } void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool saveCredentials) @@ -191,7 +191,7 @@ void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool s // Save accepted certificates. settings.beginGroup(QLatin1String("General")); - qCDebug(lcAccountManager) << "Saving " << acc->approvedCerts().count() << " unknown certs."; + qCInfo(lcAccountManager) << "Saving " << acc->approvedCerts().count() << " unknown certs."; QByteArray certs; Q_FOREACH( const QSslCertificate& cert, acc->approvedCerts() ) { certs += cert.toPem() + '\n'; @@ -205,7 +205,7 @@ void AccountManager::saveAccountHelper(Account* acc, QSettings& settings, bool s if (acc->_am) { CookieJar* jar = qobject_cast(acc->_am->cookieJar()); if (jar) { - qCDebug(lcAccountManager) << "Saving cookies." << acc->cookieJarPath(); + qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath(); jar->save(acc->cookieJarPath()); } } @@ -216,7 +216,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings) auto urlConfig = settings.value(QLatin1String(urlC)); if (!urlConfig.isValid()) { // No URL probably means a corrupted entry in the account settings - qCDebug(lcAccountManager) << "No URL for account " << settings.group(); + qCWarning(lcAccountManager) << "No URL for account " << settings.group(); return AccountPtr(); } @@ -245,7 +245,7 @@ AccountPtr AccountManager::loadAccountHelper(QSettings& settings) acc->setUrl(urlConfig.toUrl()); } - qCDebug(lcAccountManager) << "Account for" << acc->url() << "using auth type" << authType; + qCInfo(lcAccountManager) << "Account for" << acc->url() << "using auth type" << authType; acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString(); diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp index ec869f91d9..e4ea56e189 100644 --- a/src/gui/accountsettings.cpp +++ b/src/gui/accountsettings.cpp @@ -329,7 +329,7 @@ void AccountSettings::slotFolderWizardAccepted() FolderWizard *folderWizard = qobject_cast(sender()); FolderMan *folderMan = FolderMan::instance(); - qCDebug(lcAccountSettings) << "* Folder wizard completed"; + qCInfo(lcAccountSettings) << "Folder wizard completed"; FolderDefinition definition; definition.localPath = FolderDefinition::prepareLocalPath( @@ -340,7 +340,7 @@ void AccountSettings::slotFolderWizardAccepted() { QDir dir(definition.localPath); if (!dir.exists()) { - qCDebug(lcAccountSettings) << "Creating folder" << definition.localPath; + qCInfo(lcAccountSettings) << "Creating folder" << definition.localPath; if (!dir.mkpath(".")) { QMessageBox::warning(this, tr("Folder creation failed"), tr("

Could not create local folder %1.") @@ -375,7 +375,7 @@ void AccountSettings::slotFolderWizardAccepted() void AccountSettings::slotFolderWizardRejected() { - qCDebug(lcAccountSettings) << "* Folder wizard cancelled"; + qCInfo(lcAccountSettings) << "Folder wizard cancelled"; FolderMan *folderMan = FolderMan::instance(); folderMan->setSyncEnabled(true); } @@ -388,7 +388,7 @@ void AccountSettings::slotRemoveCurrentFolder() if( selected.isValid() && folder ) { int row = selected.row(); - qCDebug(lcAccountSettings) << "Remove Folder alias " << folder->alias(); + qCInfo(lcAccountSettings) << "Remove Folder alias " << folder->alias(); QString shortGuiLocalPath = folder->shortGuiLocalPath(); QMessageBox messageBox(QMessageBox::Question, @@ -460,7 +460,7 @@ void AccountSettings::slotEnableCurrentFolder() if( !alias.isEmpty() ) { FolderMan *folderMan = FolderMan::instance(); - qCDebug(lcAccountSettings) << "Application: enable folder with alias " << alias; + qCInfo(lcAccountSettings) << "Application: enable folder with alias " << alias; bool terminate = false; bool currentlyPaused = false; @@ -667,7 +667,7 @@ void AccountSettings::slotLinkActivated(const QString& link) ui->_folderList->setCurrentIndex(indx); ui->_folderList->scrollTo(indx); } else { - qCDebug(lcAccountSettings) << "Unable to find a valid index for " << myFolder; + qCWarning(lcAccountSettings) << "Unable to find a valid index for " << myFolder; } } } diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index dae976134a..b141974673 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -86,7 +86,7 @@ AccountState::State AccountState::state() const void AccountState::setState(State state) { if (_state != state) { - qCDebug(lcAccountState) << "AccountState state change: " + qCInfo(lcAccountState) << "AccountState state change: " << stateString(_state) << "->" << stateString(state); State oldState = _state; _state = state; @@ -171,7 +171,7 @@ void AccountState::checkConnectivity() } if (_connectionValidator) { - qCDebug(lcAccountState) << "ConnectionValidator already running, ignoring" << account()->displayName(); + qCWarning(lcAccountState) << "ConnectionValidator already running, ignoring" << account()->displayName(); return; } @@ -182,7 +182,7 @@ void AccountState::checkConnectivity() if (isConnected() && _timeSinceLastETagCheck.isValid() && _timeSinceLastETagCheck.elapsed() < polltime) { - //qCDebug(lcAccountState) << account()->displayName() << "The last ETag check succeeded within the last " << polltime/1000 << " secs. No connection check needed!"; + qCDebug(lcAccountState) << account()->displayName() << "The last ETag check succeeded within the last " << polltime/1000 << " secs. No connection check needed!"; return; } @@ -217,12 +217,12 @@ void AccountState::checkConnectivity() void AccountState::slotConnectionValidatorResult(ConnectionValidator::Status status, const QStringList& errors) { if (isSignedOut()) { - qCDebug(lcAccountState) << "Signed out, ignoring" << connectionStatusString(status) << _account->url().toString(); + qCWarning(lcAccountState) << "Signed out, ignoring" << connectionStatusString(status) << _account->url().toString(); return; } if (_connectionStatus != status) { - qCDebug(lcAccountState) << "AccountState connection status change: " + qCInfo(lcAccountState) << "AccountState connection status change: " << connectionStatusString(_connectionStatus) << "->" << connectionStatusString(status); _connectionStatus = status; diff --git a/src/gui/activitylistmodel.cpp b/src/gui/activitylistmodel.cpp index 696e53e4e9..fb1201ef38 100644 --- a/src/gui/activitylistmodel.cpp +++ b/src/gui/activitylistmodel.cpp @@ -140,7 +140,7 @@ void ActivityListModel::startFetchJob(AccountState* s) job->addQueryParams(params); _currentlyFetching.insert(s); - qCDebug(lcActivity) << "Start fetching activities for " << s->account()->displayName(); + qCInfo(lcActivity) << "Start fetching activities for " << s->account()->displayName(); job->start(); } diff --git a/src/gui/activitywidget.cpp b/src/gui/activitywidget.cpp index 5be315f4ce..1766793162 100644 --- a/src/gui/activitywidget.cpp +++ b/src/gui/activitywidget.cpp @@ -120,7 +120,7 @@ void ActivityWidget::slotRefreshNotifications(AccountState *ptr) snh->slotFetchNotifications(ptr); } else { - qCDebug(lcActivity) << "========> notification request counter not zero."; + qCWarning(lcActivity) << "Notification request counter not zero."; } } @@ -252,7 +252,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list) foreach( auto activity, list ) { if( _blacklistedNotifications.contains(activity)) { - qCDebug(lcActivity) << "Activity in blacklist, skip"; + qCInfo(lcActivity) << "Activity in blacklist, skip"; continue; } @@ -376,7 +376,7 @@ void ActivityWidget::slotBuildNotificationDisplay(const ActivityList& list) void ActivityWidget::slotSendNotificationRequest(const QString& accountName, const QString& link, const QByteArray& verb) { - qCDebug(lcActivity) << "Server Notification Request " << verb << link << "on account" << accountName; + qCInfo(lcActivity) << "Server Notification Request " << verb << link << "on account" << accountName; NotificationWidget *theSender = qobject_cast(sender()); const QStringList validVerbs = QStringList() << "GET" << "PUT" << "POST" << "DELETE"; @@ -399,7 +399,7 @@ void ActivityWidget::slotSendNotificationRequest(const QString& accountName, con _notificationRequestsRunning++; } } else { - qCDebug(lcActivity) << "Notification Links: Invalid verb:" << verb; + qCWarning(lcActivity) << "Notification Links: Invalid verb:" << verb; } } @@ -421,7 +421,7 @@ void ActivityWidget::slotNotifyNetworkError( QNetworkReply *reply) int resultCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); endNotificationRequest(job->widget(), resultCode); - qCDebug(lcActivity) << "Server notify job failed with code " << resultCode; + qCWarning(lcActivity) << "Server notify job failed with code " << resultCode; } @@ -434,7 +434,7 @@ void ActivityWidget::slotNotifyServerFinished( const QString& reply, int replyCo endNotificationRequest(job->widget(), replyCode); // FIXME: remove the widget after a couple of seconds - qCDebug(lcActivity) << "Server Notification reply code"<< replyCode << reply; + qCInfo(lcActivity) << "Server Notification reply code"<< replyCode << reply; // if the notification was successful start a timer that triggers // removal of the done widgets in a few seconds @@ -635,7 +635,7 @@ void ActivitySettings::slotRefresh( AccountState* ptr ) // Fetch Activities only if visible and if last check is longer than 15 secs ago if( timer.isValid() && timer.elapsed() < NOTIFICATION_REQUEST_FREE_PERIOD ) { - qCDebug(lcActivity) << "do not check as last check is only secs ago: " << timer.elapsed() / 1000; + qCDebug(lcActivity) << "Do not check as last check is only secs ago: " << timer.elapsed() / 1000; return; } if( ptr && ptr->isConnected() ) { diff --git a/src/gui/application.cpp b/src/gui/application.cpp index aac0666cf0..863298304e 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -81,7 +81,7 @@ QString applicationTrPath() QString devTrPath = qApp->applicationDirPath() + QString::fromLatin1("/../src/gui/"); if (QDir(devTrPath).exists()) { // might miss Qt, QtKeyChain, etc. - qCDebug(lcApplication) << "Running from build location! Translations may be incomplete!"; + qCWarning(lcApplication) << "Running from build location! Translations may be incomplete!"; return devTrPath; } #if defined(Q_OS_WIN) @@ -150,7 +150,7 @@ Application::Application(int &argc, char **argv) : setupTranslations(); // Setup global excludes - qCDebug(lcApplication) << "Loading global exclude list"; + qCInfo(lcApplication) << "Loading global exclude list"; ConfigFile cfg; ExcludedFiles& excludes = ExcludedFiles::instance(); excludes.addExcludeFilePath( cfg.excludeFile(ConfigFile::SystemScope) ); @@ -167,7 +167,7 @@ Application::Application(int &argc, char **argv) : // (non-existence is not an error) Utility::sleep(5); if (!AccountManager::instance()->restore()) { - qCDebug(lcApplication) << "Could not read the account settings, quitting"; + qCCritical(lcApplication) << "Could not read the account settings, quitting"; QMessageBox::critical( 0, tr("Error accessing the configuration file"), @@ -381,7 +381,7 @@ void Application::slotParseMessage(const QString &msg, QObject*) parseOptions(options); setupLogging(); } else if (msg.startsWith(QLatin1String("MSG_SHOWSETTINGS"))) { - qCDebug(lcApplication) << "Running for" << _startedAt.elapsed()/1000.0 << "sec"; + qCInfo(lcApplication) << "Running for" << _startedAt.elapsed()/1000.0 << "sec"; if (_startedAt.elapsed() < 10*1000) { // This call is mirrored with the one in int main() qCWarning(lcApplication) << "Ignoring MSG_SHOWSETTINGS, possibly double-invocation of client via session restore and auto start"; @@ -571,7 +571,7 @@ void Application::setupTranslations() // for us to accept the language. Otherwise, we try with the next. // "en" is an exception as it is the default language and may not // have a translation file provided. - qCDebug(lcApplication) << "Using" << lang << "translation"; + qCInfo(lcApplication) << "Using" << lang << "translation"; setProperty("ui_lang", lang); const QString qtTrPath = QLibraryInfo::location(QLibraryInfo::TranslationsPath); const QString qtTrFile = QLatin1String("qt_") + lang; diff --git a/src/gui/creds/shibboleth/shibbolethwebview.cpp b/src/gui/creds/shibboleth/shibbolethwebview.cpp index ccc9a96a57..fb5709bb7c 100644 --- a/src/gui/creds/shibboleth/shibbolethwebview.cpp +++ b/src/gui/creds/shibboleth/shibbolethwebview.cpp @@ -155,7 +155,7 @@ void ShibbolethWebView::slotLoadFinished(bool success) } if (!success) { - qCDebug(lcShibboleth) << "Could not load Shibboleth login page to log you in."; + qCWarning(lcShibboleth) << "Could not load Shibboleth login page to log you in."; } } diff --git a/src/gui/creds/shibbolethcredentials.cpp b/src/gui/creds/shibbolethcredentials.cpp index f34ed9aaed..d5dd1726cf 100644 --- a/src/gui/creds/shibbolethcredentials.cpp +++ b/src/gui/creds/shibbolethcredentials.cpp @@ -214,11 +214,11 @@ void ShibbolethCredentials::slotUserFetched(const QString &user) { if (_user.isEmpty()) { if (user.isEmpty()) { - qCDebug(lcShibboleth) << "Failed to fetch the shibboleth user"; + qCWarning(lcShibboleth) << "Failed to fetch the shibboleth user"; } _user = user; } else if (user != _user) { - qCDebug(lcShibboleth) << "Wrong user: " << user << "!=" << _user; + qCWarning(lcShibboleth) << "Wrong user: " << user << "!=" << _user; QMessageBox::warning(_browser, tr("Login Error"), tr("You must sign in as user %1").arg(_user)); invalidateToken(); showLoginWindow(); diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index c132d60e91..8230d6b2fe 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -125,7 +125,7 @@ void Folder::checkLocalPath() const QFileInfo fi(_definition.localPath); _canonicalLocalPath = fi.canonicalFilePath(); if (_canonicalLocalPath.isEmpty()) { - qCDebug(lcFolder) << "Broken symlink:" << _definition.localPath; + qCWarning(lcFolder) << "Broken symlink:" << _definition.localPath; _canonicalLocalPath = _definition.localPath; } else if( !_canonicalLocalPath.endsWith('/') ) { _canonicalLocalPath.append('/'); @@ -271,17 +271,17 @@ void Folder::prepareToSync() void Folder::slotRunEtagJob() { - qCDebug(lcFolder) << "Trying to check" << remoteUrl().toString() << "for changes via ETag check. (time since last sync:" << (_timeSinceLastSyncDone.elapsed() / 1000) << "s)"; + qCInfo(lcFolder) << "Trying to check" << remoteUrl().toString() << "for changes via ETag check. (time since last sync:" << (_timeSinceLastSyncDone.elapsed() / 1000) << "s)"; AccountPtr account = _accountState->account(); if (_requestEtagJob) { - qCDebug(lcFolder) << remoteUrl().toString() << "has ETag job queued, not trying to sync"; + qCInfo(lcFolder) << remoteUrl().toString() << "has ETag job queued, not trying to sync"; return; } if (!canSync()) { - qCDebug(lcFolder) << "Not syncing. :" << remoteUrl().toString() << _definition.paused << AccountState::stateString(_accountState->state()); + qCInfo(lcFolder) << "Not syncing. :" << remoteUrl().toString() << _definition.paused << AccountState::stateString(_accountState->state()); return; } @@ -302,7 +302,7 @@ void Folder::etagRetreived(const QString& etag) FolderMan::instance()->setSyncEnabled(true); if (_lastEtag != etag) { - qCDebug(lcFolder) << "Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED"; + qCInfo(lcFolder) << "Compare etag with previous etag: last:" << _lastEtag << ", received:" << etag << "-> CHANGED"; _lastEtag = etag; slotScheduleThisFolder(); } @@ -312,7 +312,7 @@ void Folder::etagRetreived(const QString& etag) void Folder::etagRetreivedFromSyncEngine(const QString& etag) { - qCDebug(lcFolder) << "Root etag from during sync:" << etag; + qCInfo(lcFolder) << "Root etag from during sync:" << etag; accountState()->tagLastSuccessfullETagRequest(); _lastEtag = etag; } @@ -348,7 +348,7 @@ void Folder::showSyncResultPopup() createGuiLog( _syncResult.firstItemError()->_file, LogStatusError, errorCount ); } - qCDebug(lcFolder) << "Folder slotSyncFinished: result: " << int(_syncResult.status()); + qCInfo(lcFolder) << "Folder sync result: " << int(_syncResult.status()); } void Folder::createGuiLog( const QString& filename, LogStatus status, int count, @@ -427,7 +427,7 @@ int Folder::slotDiscardDownloadProgress() _journal.getAndDeleteStaleDownloadInfos(keep_nothing); foreach (const SyncJournalDb::DownloadInfo & deleted_info, deleted_infos) { const QString tmppath = folderpath.filePath(deleted_info._tmpfile); - qCDebug(lcFolder) << "Deleting temporary file: " << tmppath; + qCInfo(lcFolder) << "Deleting temporary file: " << tmppath; FileSystem::remove(tmppath); } return deleted_infos.size(); @@ -473,7 +473,7 @@ void Folder::slotWatchedPathChanged(const QString& path) auto record = _journal.getFileRecord(relativePath); if (record.isValid() && !FileSystem::fileChanged(path, record._fileSize, Utility::qDateTimeToTime_t(record._modtime))) { - qCDebug(lcFolder) << "Ignoring spurious notification for file" << relativePath; + qCInfo(lcFolder) << "Ignoring spurious notification for file" << relativePath; return; // probably a spurious notification } } @@ -517,7 +517,7 @@ void Folder::saveToSettings() const FolderDefinition::save(*settings, _definition); settings->sync(); - qCDebug(lcFolder) << "Saved folder" << _definition.alias << "to settings, status" << settings->status(); + qCInfo(lcFolder) << "Saved folder" << _definition.alias << "to settings, status" << settings->status(); } void Folder::removeFromSettings() const @@ -542,7 +542,7 @@ bool Folder::isFileExcludedRelative(const QString& relativePath) const void Folder::slotTerminateSync() { - qCDebug(lcFolder) << "folder " << alias() << " Terminating!"; + qCInfo(lcFolder) << "folder " << alias() << " Terminating!"; if( _engine->isSyncRunning() ) { _engine->abort(); @@ -568,12 +568,12 @@ void Folder::wipe() QFile file(stateDbFile); if( file.exists() ) { if( !file.remove()) { - qCDebug(lcFolder) << "WRN: Failed to remove existing csync StateDB " << stateDbFile; + qCWarning(lcFolder) << "Failed to remove existing csync StateDB " << stateDbFile; } else { - qCDebug(lcFolder) << "wipe: Removed csync StateDB " << stateDbFile; + qCInfo(lcFolder) << "wipe: Removed csync StateDB " << stateDbFile; } } else { - qCDebug(lcFolder) << "WRN: statedb is empty, can not remove."; + qCWarning(lcFolder) << "statedb is empty, can not remove."; } // Also remove other db related files @@ -594,12 +594,12 @@ bool Folder::setIgnoredFiles() // a QSet of files to load. ConfigFile cfg; QString systemList = cfg.excludeFile(ConfigFile::SystemScope); - qCDebug(lcFolder) << "Adding system ignore list to csync:" << systemList; + qCInfo(lcFolder) << "Adding system ignore list to csync:" << systemList; _engine->excludedFiles().addExcludeFilePath(systemList); QString userList = cfg.excludeFile(ConfigFile::UserScope); if( QFile::exists(userList) ) { - qCDebug(lcFolder) << "Adding user defined ignore list to csync:" << userList; + qCInfo(lcFolder) << "Adding user defined ignore list to csync:" << userList; _engine->excludedFiles().addExcludeFilePath(userList); } @@ -633,7 +633,7 @@ void Folder::startSync(const QStringList &pathList) _syncResult.setStatus( SyncResult::SyncPrepare ); emit syncStateChange(); - qCDebug(lcFolder) << "*** Start syncing " << remoteUrl().toString() << " - client version" + qCInfo(lcFolder) << "*** Start syncing " << remoteUrl().toString() << " - client version" << qPrintable(Theme::instance()->version()); _fileLog->start(path()); @@ -730,7 +730,7 @@ void Folder::slotSyncError(const QString& err) void Folder::slotSyncStarted() { - qCDebug(lcFolder) << "#### Propagation start #################################################### >>"; + qCInfo(lcFolder) << "#### Propagation start ####################################################"; _syncResult.setStatus(SyncResult::SyncRunning); emit syncStateChange(); } @@ -742,7 +742,7 @@ void Folder::slotCsyncUnavailable() void Folder::slotSyncFinished(bool success) { - qCDebug(lcFolder) << "Client version" << qPrintable(Theme::instance()->version()) + qCInfo(lcFolder) << "Client version" << qPrintable(Theme::instance()->version()) << " Qt" << qVersion() #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) << " SSL " << QSslSocket::sslLibraryVersionString().toUtf8().data() @@ -751,9 +751,9 @@ void Folder::slotSyncFinished(bool success) bool syncError = !_syncResult.errorStrings().isEmpty(); if( syncError ) { - qCDebug(lcFolder) << "SyncEngine finished with ERROR"; + qCWarning(lcFolder) << "SyncEngine finished with ERROR"; } else { - qCDebug(lcFolder) << "SyncEngine finished without problem."; + qCInfo(lcFolder) << "SyncEngine finished without problem."; } _fileLog->finish(); showSyncResultPopup(); @@ -762,10 +762,9 @@ void Folder::slotSyncFinished(bool success) if (syncError) { _syncResult.setStatus(SyncResult::Error); - qCDebug(lcFolder) << "ownCloud csync thread finished with error"; } else if (_csyncUnavail) { _syncResult.setStatus(SyncResult::Error); - qCDebug(lcFolder) << "csync not available."; + qCWarning(lcFolder) << "csync not available."; } else if( _syncResult.foundFilesNotSynced() ) { _syncResult.setStatus(SyncResult::Problem); } else if( _definition.paused ) { @@ -784,7 +783,7 @@ void Folder::slotSyncFinished(bool success) else { _consecutiveFailingSyncs++; - qCDebug(lcFolder) << "the last" << _consecutiveFailingSyncs << "syncs failed"; + qCInfo(lcFolder) << "the last" << _consecutiveFailingSyncs << "syncs failed"; } if (_syncResult.status() == SyncResult::Success && success) { @@ -808,7 +807,7 @@ void Folder::slotSyncFinished(bool success) // Increment the follow-up sync counter if necessary. if (anotherSyncNeeded == ImmediateFollowUp) { _consecutiveFollowUpSyncs++; - qCDebug(lcFolder) << "another sync was requested by the finished sync, this has" + qCInfo(lcFolder) << "another sync was requested by the finished sync, this has" << "happened" << _consecutiveFollowUpSyncs << "times"; } else { _consecutiveFollowUpSyncs = 0; diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 03b32581a7..367e9072f9 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -58,7 +58,7 @@ FolderMan::FolderMan(QObject *parent) : ConfigFile cfg; int polltime = cfg.remotePollInterval(); - qCDebug(lcFolderMan) << "setting remote poll timer interval to" << polltime << "msec"; + qCInfo(lcFolderMan) << "setting remote poll timer interval to" << polltime << "msec"; _etagPollTimer.setInterval( polltime ); QObject::connect(&_etagPollTimer, SIGNAL(timeout()), this, SLOT(slotEtagPollTimerTimeout())); _etagPollTimer.start(); @@ -206,7 +206,7 @@ int FolderMan::setupFolders() return r; } - qCDebug(lcFolderMan) << "* Setup folders from settings file"; + qCInfo(lcFolderMan) << "Setup folders from settings file"; foreach (const auto& account, AccountManager::instance()->accounts()) { const auto id = account->account()->id(); @@ -266,7 +266,7 @@ int FolderMan::setupFoldersMigration() QDir storageDir(cfg.configPath()); _folderConfigPath = cfg.configPath() + QLatin1String("folders"); - qCDebug(lcFolderMan) << "* Setup folders from " << _folderConfigPath << "(migration)"; + qCInfo(lcFolderMan) << "Setup folders from " << _folderConfigPath << "(migration)"; QDir dir( _folderConfigPath ); //We need to include hidden files just in case the alias starts with '.' @@ -293,7 +293,7 @@ bool FolderMan::ensureJournalGone( const QString& journalDbFile ) { // remove the old journal file while (QFile::exists(journalDbFile) && !QFile::remove(journalDbFile)) { - qCDebug(lcFolderMan) << "Could not remove old db file at" << journalDbFile; + qCWarning(lcFolderMan) << "Could not remove old db file at" << journalDbFile; int ret = QMessageBox::warning(0, tr("Could not reset folder state"), tr("An old sync journal '%1' was found, " "but could not be removed. Please make sure " @@ -371,7 +371,7 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat { Folder *folder = 0; - qCDebug(lcFolderMan) << " ` -> setting up:" << file; + qCInfo(lcFolderMan) << " ` -> setting up:" << file; QString escapedAlias(file); // check the unescaped variant (for the case when the filename comes out // of the directory listing). If the file does not exist, escape the @@ -384,12 +384,12 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat cfgFile.setFile( _folderConfigPath, escapedAlias ); } if( !cfgFile.isReadable() ) { - qCDebug(lcFolderMan) << "Cannot read folder definition for alias " << cfgFile.filePath(); + qCWarning(lcFolderMan) << "Cannot read folder definition for alias " << cfgFile.filePath(); return folder; } QSettings settings( _folderConfigPath + QLatin1Char('/') + escapedAlias, QSettings::IniFormat); - qCDebug(lcFolderMan) << " -> file path: " << settings.fileName(); + qCInfo(lcFolderMan) << " -> file path: " << settings.fileName(); // Check if the filename is equal to the group setting. If not, use the group // name as an alias. @@ -419,7 +419,7 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat } if (!accountState) { - qCWarning(lcFolderMan) << "can't create folder without an account"; + qCCritical(lcFolderMan) << "can't create folder without an account"; return 0; } @@ -443,7 +443,7 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat folder->saveToSettings(); } - qCDebug(lcFolderMan) << "Migrated!" << folder; + qCInfo(lcFolderMan) << "Migrated!" << folder; settings.sync(); return folder; } @@ -451,7 +451,7 @@ Folder* FolderMan::setupFolderFromOldConfigFile(const QString &file, AccountStat void FolderMan::slotFolderSyncPaused( Folder *f, bool paused ) { if( !f ) { - qCWarning(lcFolderMan) << "!! slotFolderSyncPaused called with empty folder"; + qCCritical(lcFolderMan) << "slotFolderSyncPaused called with empty folder"; return; } @@ -509,7 +509,7 @@ void FolderMan::scheduleAllFolders() void FolderMan::slotScheduleAppRestart() { _appRestartRequired = true; - qCDebug(lcFolderMan) << "## Application restart requested!"; + qCInfo(lcFolderMan) << "Application restart requested!"; } void FolderMan::slotSyncOnceFileUnlocks(const QString& path) @@ -524,16 +524,16 @@ void FolderMan::slotSyncOnceFileUnlocks(const QString& path) void FolderMan::scheduleFolder( Folder *f ) { if( !f ) { - qCWarning(lcFolderMan) << "slotScheduleSync called with null folder"; + qCCritical(lcFolderMan) << "slotScheduleSync called with null folder"; return; } auto alias = f->alias(); - qCDebug(lcFolderMan) << "Schedule folder " << alias << " to sync!"; + qCInfo(lcFolderMan) << "Schedule folder " << alias << " to sync!"; if( ! _scheduledFolders.contains(f) ) { if( !f->canSync() ) { - qCDebug(lcFolderMan) << "Folder is not ready to sync, not scheduled!"; + qCInfo(lcFolderMan) << "Folder is not ready to sync, not scheduled!"; _socketApi->slotUpdateFolderView(f); return; } @@ -542,7 +542,7 @@ void FolderMan::scheduleFolder( Folder *f ) _scheduledFolders.enqueue(f); emit scheduleQueueChanged(); } else { - qCDebug(lcFolderMan) << " II> Sync for folder " << alias << " already scheduled, do not enqueue!"; + qCInfo(lcFolderMan) << "Sync for folder " << alias << " already scheduled, do not enqueue!"; } startScheduledSyncSoon(); @@ -551,10 +551,10 @@ void FolderMan::scheduleFolder( Folder *f ) void FolderMan::scheduleFolderNext(Folder* f) { auto alias = f->alias(); - qCDebug(lcFolderMan) << "Schedule folder " << alias << " to sync! Front-of-queue."; + qCInfo(lcFolderMan) << "Schedule folder " << alias << " to sync! Front-of-queue."; if( !f->canSync() ) { - qCDebug(lcFolderMan) << "Folder is not ready to sync, not scheduled!"; + qCInfo(lcFolderMan) << "Folder is not ready to sync, not scheduled!"; return; } @@ -617,7 +617,7 @@ void FolderMan::slotAccountStateChanged() QString accountName = accountState->account()->displayName(); if (accountState->isConnected()) { - qCDebug(lcFolderMan) << "Account" << accountName << "connected, scheduling its folders"; + qCInfo(lcFolderMan) << "Account" << accountName << "connected, scheduling its folders"; foreach (Folder *f, _folderMap.values()) { if (f @@ -627,7 +627,7 @@ void FolderMan::slotAccountStateChanged() } } } else { - qCDebug(lcFolderMan) << "Account" << accountName << "disconnected or paused, " + qCInfo(lcFolderMan) << "Account" << accountName << "disconnected or paused, " "terminating or descheduling sync folders"; if (_currentSyncFolder @@ -694,7 +694,7 @@ void FolderMan::startScheduledSyncSoon() // Time since the last sync run counts against the delay msDelay = qMax(1ll, msDelay - msSinceLastSync); - qCDebug(lcFolderMan) << "Starting the next scheduled sync in" << (msDelay/1000) << "seconds"; + qCInfo(lcFolderMan) << "Starting the next scheduled sync in" << (msDelay/1000) << "seconds"; _startScheduledSyncTimer.start(msDelay); } @@ -706,16 +706,16 @@ void FolderMan::startScheduledSyncSoon() void FolderMan::slotStartScheduledFolderSync() { if( _currentSyncFolder ) { - qCDebug(lcFolderMan) << "Currently folder " << _currentSyncFolder->remoteUrl().toString() << " is running, wait for finish!"; + qCInfo(lcFolderMan) << "Currently folder " << _currentSyncFolder->remoteUrl().toString() << " is running, wait for finish!"; return; } if( ! _syncEnabled ) { - qCDebug(lcFolderMan) << "FolderMan: Syncing is disabled, no scheduling."; + qCInfo(lcFolderMan) << "FolderMan: Syncing is disabled, no scheduling."; return; } - qCDebug(lcFolderMan) << "XX slotScheduleFolderSync: folderQueue size: " << _scheduledFolders.count(); + qCDebug(lcFolderMan) << "folderQueue size: " << _scheduledFolders.count(); if( _scheduledFolders.isEmpty() ) { return; } @@ -799,7 +799,7 @@ void FolderMan::slotServerVersionChanged(Account *account) { // Pause folders if the server version is unsupported if (account->serverVersionUnsupported()) { - qCDebug(lcFolderMan) << "The server version is unsupported:" << account->serverVersion() + qCWarning(lcFolderMan) << "The server version is unsupported:" << account->serverVersion() << "pausing all folders on the account"; foreach (auto& f, _folderMap) { @@ -832,7 +832,7 @@ void FolderMan::slotScheduleFolderByTime() bool forceSyncIntervalExpired = quint64(msecsSinceSync) > ConfigFile().forceSyncInterval(); if (forceSyncIntervalExpired) { - qCDebug(lcFolderMan) << "** scheduling folder" << f->alias() + qCInfo(lcFolderMan) << "Scheduling folder" << f->alias() << "because it has been" << msecsSinceSync << "ms " << "since the last sync"; @@ -849,7 +849,7 @@ void FolderMan::slotScheduleFolderByTime() syncAgainDelay = 60 * 1000; // 60s for each further attempt if (syncAgain && msecsSinceSync > syncAgainDelay) { - qCDebug(lcFolderMan) << "** scheduling folder" << f->alias() + qCInfo(lcFolderMan) << "Scheduling folder" << f->alias() << ", the last" << f->consecutiveFailingSyncs() << "syncs failed" << ", anotherSyncNeeded" << f->syncEngine().isAnotherSyncNeeded() << ", last status:" << f->syncResult().statusString() @@ -865,7 +865,7 @@ void FolderMan::slotScheduleFolderByTime() void FolderMan::slotFolderSyncStarted( ) { - qCDebug(lcFolderMan) << ">===================================== sync started for " << _currentSyncFolder->remoteUrl().toString(); + qCInfo(lcFolderMan) << ">===================================== sync started for " << _currentSyncFolder->remoteUrl().toString(); } /* @@ -876,7 +876,7 @@ void FolderMan::slotFolderSyncStarted( ) */ void FolderMan::slotFolderSyncFinished( const SyncResult& ) { - qCDebug(lcFolderMan) << "<===================================== sync finished for " << _currentSyncFolder->remoteUrl().toString(); + qCInfo(lcFolderMan) << "<===================================== sync finished for " << _currentSyncFolder->remoteUrl().toString(); _lastSyncFolder = _currentSyncFolder; _currentSyncFolder = 0; @@ -927,7 +927,7 @@ Folder* FolderMan::addFolderInternal(FolderDefinition folderDefinition, auto folder = new Folder(folderDefinition, accountState, this ); - qCDebug(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias(); + qCInfo(lcFolderMan) << "Adding folder to Folder Map " << folder << folder->alias(); _folderMap[folder->alias()] = folder; if (folder->syncPaused()) { _disabledFolders.insert(folder); @@ -988,11 +988,11 @@ QStringList FolderMan::findFileInLocalFolders( const QString& relPath, const Acc void FolderMan::removeFolder( Folder *f ) { if( !f ) { - qCWarning(lcFolderMan) << "!! Can not remove null folder"; + qCCritical(lcFolderMan) << "Can not remove null folder"; return; } - qCDebug(lcFolderMan) << "Removing " << f->alias(); + qCInfo(lcFolderMan) << "Removing " << f->alias(); const bool currentlyRunning = (_currentSyncFolder == f); if( currentlyRunning ) { @@ -1079,14 +1079,14 @@ bool FolderMan::startFromScratch( const QString& localFolder ) QString newName = getBackupName( parentDir.absoluteFilePath( folderName ) ); QString renameError; if( !FileSystem::rename( fi.absoluteFilePath(), newName, &renameError ) ) { - qCDebug(lcFolderMan) << "startFromScratch: Could not rename" << fi.absoluteFilePath() + qCWarning(lcFolderMan) << "startFromScratch: Could not rename" << fi.absoluteFilePath() << "to" << newName << "error:" << renameError; return false; } } if( !parentDir.mkdir( fi.absoluteFilePath() ) ) { - qCDebug(lcFolderMan) << "startFromScratch: Could not mkdir" << fi.absoluteFilePath(); + qCWarning(lcFolderMan) << "startFromScratch: Could not mkdir" << fi.absoluteFilePath(); return false; } @@ -1439,7 +1439,7 @@ void FolderMan::restartApplication() { if( Utility::isLinux() ) { // restart: - qCDebug(lcFolderMan) << "### Restarting application NOW, PID" << qApp->applicationPid() << "is ending."; + qCInfo(lcFolderMan) << "Restarting application NOW, PID" << qApp->applicationPid() << "is ending."; qApp->quit(); QStringList args = qApp->arguments(); QString prg = args.takeFirst(); diff --git a/src/gui/folderstatusmodel.cpp b/src/gui/folderstatusmodel.cpp index 969f23c611..bb8edb746b 100644 --- a/src/gui/folderstatusmodel.cpp +++ b/src/gui/folderstatusmodel.cpp @@ -626,7 +626,7 @@ void FolderStatusModel::slotUpdateDirectories(const QStringList &list) auto selectiveSyncUndecidedList = parentInfo->_folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok2); if( !(ok1 && ok2) ) { - qCDebug(lcFolderStatus) << "Could not retrieve selective sync info from journal"; + qCWarning(lcFolderStatus) << "Could not retrieve selective sync info from journal"; return; } @@ -800,7 +800,7 @@ void FolderStatusModel::slotApplySelectiveSync() bool ok; auto oldBlackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); if( !ok ) { - qCDebug(lcFolderStatus) << "Could not read selective sync list from db."; + qCWarning(lcFolderStatus) << "Could not read selective sync list from db."; return; } QStringList blackList = createBlackList(&_folders[i], oldBlackList); @@ -1080,7 +1080,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders() bool ok; auto undecidedList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncUndecidedList, &ok); if( !ok ) { - qCDebug(lcFolderStatus) << "Could not read selective sync list from db."; + qCWarning(lcFolderStatus) << "Could not read selective sync list from db."; return; } @@ -1092,7 +1092,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders() // Remove all undecided folders from the blacklist auto blackList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); if( !ok ) { - qCDebug(lcFolderStatus) << "Could not read selective sync list from db."; + qCWarning(lcFolderStatus) << "Could not read selective sync list from db."; return; } foreach (const auto& undecidedFolder, undecidedList) { @@ -1103,7 +1103,7 @@ void FolderStatusModel::slotSyncAllPendingBigFolders() // Add all undecided folders to the white list auto whiteList = folder->journalDb()->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok); if( !ok ) { - qCDebug(lcFolderStatus) << "Could not read selective sync list from db."; + qCWarning(lcFolderStatus) << "Could not read selective sync list from db."; return; } whiteList += undecidedList; diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp index cd4a5c9ad8..8a9308aa6a 100644 --- a/src/gui/folderwatcher.cpp +++ b/src/gui/folderwatcher.cpp @@ -102,7 +102,7 @@ void FolderWatcher::changeDetected( const QStringList& paths ) return; } - qCDebug(lcFolderWatcher) << "detected changes in paths:" << changedPaths; + qCInfo(lcFolderWatcher) << "Detected changes in paths:" << changedPaths; foreach (const QString &path, changedPaths) { emit pathChanged(path); } diff --git a/src/gui/folderwatcher_linux.cpp b/src/gui/folderwatcher_linux.cpp index 0635ae244f..5a4d2b5901 100644 --- a/src/gui/folderwatcher_linux.cpp +++ b/src/gui/folderwatcher_linux.cpp @@ -36,7 +36,7 @@ FolderWatcherPrivate::FolderWatcherPrivate(FolderWatcher *p, const QString& path _socket.reset( new QSocketNotifier(_fd, QSocketNotifier::Read) ); connect(_socket.data(), SIGNAL(activated(int)), SLOT(slotReceivedNotification(int))); } else { - qCDebug(lcFolderWatcher) << "notify_init() failed: " << strerror(errno); + qCWarning(lcFolderWatcher) << "notify_init() failed: " << strerror(errno); } QMetaObject::invokeMethod(this, "slotAddFolderRecursive", Q_ARG(QString, path)); @@ -98,7 +98,7 @@ void FolderWatcherPrivate::slotAddFolderRecursive(const QString &path) QStringList allSubfolders; if( !findFoldersBelow(QDir(path), allSubfolders)) { - qCDebug(lcFolderWatcher) << "Could not traverse all sub folders"; + qCWarning(lcFolderWatcher) << "Could not traverse all sub folders"; } QStringListIterator subfoldersIt(allSubfolders); while (subfoldersIt.hasNext()) { diff --git a/src/gui/folderwatcher_win.cpp b/src/gui/folderwatcher_win.cpp index b6fa82d637..4bf3a7a809 100644 --- a/src/gui/folderwatcher_win.cpp +++ b/src/gui/folderwatcher_win.cpp @@ -44,7 +44,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, if (_directory == INVALID_HANDLE_VALUE) { DWORD errorCode = GetLastError(); - qCDebug(lcFolderWatcher) << "Failed to create handle for" << _path << ", error:" << errorCode; + qCWarning(lcFolderWatcher) << "Failed to create handle for" << _path << ", error:" << errorCode; _directory = 0; return; } @@ -82,7 +82,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, emit changed(_path); *increaseBufferSize = true; } else { - qCDebug(lcFolderWatcher) << "ReadDirectoryChangesW error" << errorCode; + qCWarning(lcFolderWatcher) << "ReadDirectoryChangesW error" << errorCode; } break; } @@ -97,7 +97,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, break; } if (result != 0) { - qCDebug(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << GetLastError(); + qCWarning(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << GetLastError(); break; } @@ -109,7 +109,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, emit changed(_path); *increaseBufferSize = true; } else { - qCDebug(lcFolderWatcher) << "GetOverlappedResult error" << errorCode; + qCWarning(lcFolderWatcher) << "GetOverlappedResult error" << errorCode; } break; } @@ -128,7 +128,7 @@ void WatcherThread::watchChanges(size_t fileNotifyBufferSize, if (longNameSize > 0) { longfile = QString::fromUtf16(reinterpret_cast(fileNameBuffer), longNameSize); } else { - qCDebug(lcFolderWatcher) << "Error converting file name to full length, keeping original name."; + qCWarning(lcFolderWatcher) << "Error converting file name to full length, keeping original name."; } } longfile = QDir::cleanPath(longfile); diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index eada127e1e..199977efaf 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -219,7 +219,7 @@ void FolderWizardRemotePath::slotCreateRemoteFolderFinished(QNetworkReply::Netwo void FolderWizardRemotePath::slotHandleMkdirNetworkError(QNetworkReply *reply) { - qCDebug(lcWizard) << "webdav mkdir request failed:" << reply->error(); + qCWarning(lcWizard) << "webdav mkdir request failed:" << reply->error(); if( !_account->credentials()->stillValid(reply) ) { showWarn(tr("Authentication failed accessing %1").arg(Theme::instance()->appNameGUI())); } else { diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 0155c1a602..f846f6ae3b 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) if (setrlimit(RLIMIT_CORE, &core_limit) < 0) { fprintf(stderr, "Unable to set core dump limit\n"); } else { - qCDebug(lcApplication) << "Core dumps enabled"; + qCInfo(lcApplication) << "Core dumps enabled"; } } #endif @@ -114,10 +114,10 @@ int main(int argc, char **argv) // if the application is already running, notify it. if(app.isRunning()) { - qCDebug(lcApplication) << "Already running, exiting..."; + qCInfo(lcApplication) << "Already running, exiting..."; if (app.isSessionRestored()) { // This call is mirrored with the one in Application::slotParseMessage - qCDebug(lcApplication) << "Session was restored, don't notify app!"; + qCInfo(lcApplication) << "Session was restored, don't notify app!"; return -1; } diff --git a/src/gui/notificationconfirmjob.cpp b/src/gui/notificationconfirmjob.cpp index eb8ee25cdb..537f763c73 100644 --- a/src/gui/notificationconfirmjob.cpp +++ b/src/gui/notificationconfirmjob.cpp @@ -48,7 +48,7 @@ NotificationWidget *NotificationConfirmJob::widget() void NotificationConfirmJob::start() { if( !_link.isValid() ) { - qCDebug(lcNotifications) << "Attempt to trigger invalid URL: " << _link.toString(); + qCWarning(lcNotifications) << "Attempt to trigger invalid URL: " << _link.toString(); return; } QNetworkRequest req; diff --git a/src/gui/notificationwidget.cpp b/src/gui/notificationwidget.cpp index f247ec2c52..6d6cfa9528 100644 --- a/src/gui/notificationwidget.cpp +++ b/src/gui/notificationwidget.cpp @@ -111,7 +111,7 @@ void NotificationWidget::slotButtonClicked() _actionLabel = triggeredLink._label; if( ! triggeredLink._link.isEmpty() ) { - qCDebug(lcNotifications) << "Notification Link: "<< triggeredLink._verb << triggeredLink._link; + qCInfo(lcNotifications) << "Notification Link: "<< triggeredLink._verb << triggeredLink._link; _progressIndi->startAnimation(); emit sendNotificationRequest( _accountName, triggeredLink._link, triggeredLink._verb ); } @@ -129,7 +129,7 @@ void NotificationWidget::slotNotificationRequestFinished(int statusCode) // the ocs API returns stat code 100 if it succeeded. if( statusCode != OCS_SUCCESS_STATUS_CODE ) { - qCDebug(lcNotifications) << "Notification Request to Server failed, leave button visible."; + qCWarning(lcNotifications) << "Notification Request to Server failed, leave button visible."; for( i = 0; i < _buttons.count(); i++ ) { _buttons.at(i)->setEnabled(true); } diff --git a/src/gui/ocsjob.cpp b/src/gui/ocsjob.cpp index 897ec1c645..3ce9741696 100644 --- a/src/gui/ocsjob.cpp +++ b/src/gui/ocsjob.cpp @@ -107,7 +107,7 @@ bool OcsJob::finished() QJsonParseError error; auto json = QJsonDocument::fromJson(replyData, &error); if (error.error != QJsonParseError::NoError) { - qCDebug(lcOcs) << "Could not parse reply to" + qCWarning(lcOcs) << "Could not parse reply to" << _verb << Utility::concatUrlPath(account()->url(), path()) << _params @@ -118,7 +118,7 @@ bool OcsJob::finished() QString message; const int statusCode = getJsonReturnCode(json, message); if (!_passStatusCodes.contains(statusCode)) { - qCDebug(lcOcs) << "Reply to" + qCWarning(lcOcs) << "Reply to" << _verb << Utility::concatUrlPath(account()->url(), path()) << _params diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp index e8dab0eb27..a82836f8b4 100644 --- a/src/gui/owncloudgui.cpp +++ b/src/gui/owncloudgui.cpp @@ -139,10 +139,10 @@ void ownCloudGui::setupOverlayIcons() p.waitForFinished(5000); QByteArray result = p.readAll(); QString resultAsString(result); // if appropriate - qCDebug(lcApplication) << "Load Finder Overlay-Plugin: " << resultAsString << ": " << p.exitCode() + qCInfo(lcApplication) << "Load Finder Overlay-Plugin: " << resultAsString << ": " << p.exitCode() << (p.exitCode() != 0 ? p.errorString() : QString::null); } else { - qCDebug(lcApplication) << finderExtension << "does not exist! Finder Overlay Plugin loading failed"; + qCWarning(lcApplication) << finderExtension << "does not exist! Finder Overlay Plugin loading failed"; } } #endif @@ -159,7 +159,7 @@ void ownCloudGui::slotOpenSettingsDialog() _settingsDialog->close(); } } else { - qCDebug(lcApplication) << "No configured folders yet, starting setup wizard"; + qCInfo(lcApplication) << "No configured folders yet, starting setup wizard"; slotNewAccountWizard(); } } @@ -212,7 +212,7 @@ void ownCloudGui::slotSyncStateChange( Folder* folder ) auto result = folder->syncResult(); - qCDebug(lcApplication) << "Sync state changed for folder " << folder->remoteUrl().toString() << ": " << result.statusString(); + qCInfo(lcApplication) << "Sync state changed for folder " << folder->remoteUrl().toString() << ": " << result.statusString(); if (result.status() == SyncResult::Success || result.status() == SyncResult::Error) { Logger::instance()->enterNextLogFile(); @@ -500,7 +500,7 @@ void ownCloudGui::setupContextMenu() if (platformMenu && platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) { _qdbusmenuWorkaround = true; - qCDebug(lcApplication) << "Enabled QDBusPlatformMenu workaround"; + qCWarning(lcApplication) << "Enabled QDBusPlatformMenu workaround"; } } #endif @@ -693,7 +693,7 @@ void ownCloudGui::slotShowTrayMessage(const QString &title, const QString &msg) if( _tray ) _tray->showMessage(title, msg); else - qCDebug(lcApplication) << "Tray not ready: " << msg; + qCWarning(lcApplication) << "Tray not ready: " << msg; } void ownCloudGui::slotShowOptionalTrayMessage(const QString &title, const QString &msg) @@ -712,7 +712,7 @@ void ownCloudGui::slotFolderOpenAction( const QString& alias ) { Folder *f = FolderMan::instance()->folder(alias); if( f ) { - qCDebug(lcApplication) << "opening local url " << f->path(); + qCInfo(lcApplication) << "opening local url " << f->path(); QUrl url = QUrl::fromLocalFile(f->path()); #ifdef Q_OS_WIN @@ -1039,7 +1039,7 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l { const auto folder = FolderMan::instance()->folderForPath(localPath); if (!folder) { - qCDebug(lcApplication) << "Could not open share dialog for" << localPath << "no responsible folder found"; + qCWarning(lcApplication) << "Could not open share dialog for" << localPath << "no responsible folder found"; return; } @@ -1064,10 +1064,10 @@ void ownCloudGui::slotShowShareDialog(const QString &sharePath, const QString &l ShareDialog *w = 0; if (_shareDialogs.contains(localPath) && _shareDialogs[localPath]) { - qCDebug(lcApplication) << "Raising share dialog" << sharePath << localPath; + qCInfo(lcApplication) << "Raising share dialog" << sharePath << localPath; w = _shareDialogs[localPath]; } else { - qCDebug(lcApplication) << "Opening share dialog" << sharePath << localPath << maxSharingPermissions; + qCInfo(lcApplication) << "Opening share dialog" << sharePath << localPath << maxSharingPermissions; w = new ShareDialog(accountState, sharePath, localPath, maxSharingPermissions); w->setAttribute( Qt::WA_DeleteOnClose, true ); diff --git a/src/gui/owncloudsetupwizard.cpp b/src/gui/owncloudsetupwizard.cpp index cde42a53d7..7a52899791 100644 --- a/src/gui/owncloudsetupwizard.cpp +++ b/src/gui/owncloudsetupwizard.cpp @@ -158,9 +158,9 @@ void OwncloudSetupWizard::slotDetermineAuthType(const QString &urlString) void OwncloudSetupWizard::slotSystemProxyLookupDone(const QNetworkProxy &proxy) { if (proxy.type() != QNetworkProxy::NoProxy) { - qCDebug(lcWizard) << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy); + qCInfo(lcWizard) << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy); } else { - qCDebug(lcWizard) << "No system proxy set by OS"; + qCInfo(lcWizard) << "No system proxy set by OS"; } AccountPtr account = _ocWizard->account(); account->networkAccessManager()->setProxy(proxy); @@ -203,7 +203,7 @@ void OwncloudSetupWizard::slotOwnCloudFoundAuth(const QUrl& url, const QJsonObje QUrl redirectedUrl = url; redirectedUrl.setPath(url.path().left(url.path().length() - 11)); _ocWizard->account()->setUrl(redirectedUrl); - qCDebug(lcWizard) << " was redirected to" << redirectedUrl.toString(); + qCInfo(lcWizard) << " was redirected to" << redirectedUrl.toString(); } DetermineAuthTypeJob *job = new DetermineAuthTypeJob(_ocWizard->account(), this); @@ -265,7 +265,7 @@ void OwncloudSetupWizard::slotNoOwnCloudFoundAuthTimeout(const QUrl&url) void OwncloudSetupWizard::slotConnectToOCUrl( const QString& url ) { - qCDebug(lcWizard) << "Connect to url: " << url; + qCInfo(lcWizard) << "Connect to url: " << url; AbstractCredentials *creds = _ocWizard->getCredentials(); _ocWizard->account()->setCredentials(creds); _ocWizard->setField(QLatin1String("OCUrl"), url ); @@ -305,7 +305,7 @@ void OwncloudSetupWizard::slotAuthError() // the updated server URL, similar to redirects on status.php. QUrl redirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); if (!redirectUrl.isEmpty()) { - qCDebug(lcWizard) << "authed request was redirected to" << redirectUrl.toString(); + qCInfo(lcWizard) << "Authed request was redirected to" << redirectUrl.toString(); // strip the expected path QString path = redirectUrl.path(); @@ -314,7 +314,7 @@ void OwncloudSetupWizard::slotAuthError() path.chop(expectedPath.size()); redirectUrl.setPath(path); - qCDebug(lcWizard) << "setting account url to" << redirectUrl.toString(); + qCInfo(lcWizard) << "Setting account url to" << redirectUrl.toString(); _ocWizard->account()->setUrl(redirectUrl); testOwnCloudConnect(); return; @@ -376,7 +376,7 @@ bool OwncloudSetupWizard::checkDowngradeAdvised(QNetworkReply* reply) void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString& localFolder, const QString& remoteFolder) { - qCDebug(lcWizard) << "Setup local sync folder for new oC connection " << localFolder; + qCInfo(lcWizard) << "Setup local sync folder for new oC connection " << localFolder; const QDir fi( localFolder ); bool nextStep = true; @@ -395,7 +395,7 @@ void OwncloudSetupWizard::slotCreateLocalAndRemoteFolders(const QString& localFo res += tr("ok"); } else { res += tr("failed."); - qCDebug(lcWizard) << "Failed to create " << fi.path(); + qCWarning(lcWizard) << "Failed to create " << fi.path(); _ocWizard->displayError(tr("Could not create local folder %1").arg(Utility::escape(localFolder)), false); nextStep = false; } @@ -419,7 +419,7 @@ void OwncloudSetupWizard::slotRemoteFolderExists(QNetworkReply *reply) QNetworkReply::NetworkError errId = reply->error(); if( errId == QNetworkReply::NoError ) { - qCDebug(lcWizard) << "******** Remote folder found, all cool!"; + qCInfo(lcWizard) << "Remote folder found, all cool!"; } else if( errId == QNetworkReply::ContentNotFoundError ) { if( _remoteFolder.isEmpty() ) { error = tr("No remote folder specified!"); @@ -533,7 +533,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result ) FolderMan *folderMan = FolderMan::instance(); if( result == QDialog::Rejected ) { - qCDebug(lcWizard) << "Rejected the new config, use the old!"; + qCInfo(lcWizard) << "Rejected the new config, use the old!"; } else if( result == QDialog::Accepted ) { // This may or may not wipe all folder definitions, depending @@ -545,7 +545,7 @@ void OwncloudSetupWizard::slotAssistantFinished( int result ) bool startFromScratch = _ocWizard->field("OCSyncFromScratch").toBool(); if (!startFromScratch || ensureStartFromScratch(localFolder)) { - qCDebug(lcWizard) << "Adding folder definition for" << localFolder << _remoteFolder; + qCInfo(lcWizard) << "Adding folder definition for" << localFolder << _remoteFolder; FolderDefinition folderDefinition; folderDefinition.localPath = localFolder; folderDefinition.targetPath = FolderDefinition::prepareTargetPath(_remoteFolder); diff --git a/src/gui/proxyauthhandler.cpp b/src/gui/proxyauthhandler.cpp index 56fe87d353..479b3f2240 100644 --- a/src/gui/proxyauthhandler.cpp +++ b/src/gui/proxyauthhandler.cpp @@ -93,11 +93,11 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( sending_qnam = qnam_alive.data(); } if (!sending_qnam) { - qCDebug(lcProxy) << "Could not get the sending QNAM for" << sender(); + qCWarning(lcProxy) << "Could not get the sending QNAM for" << sender(); } - qCDebug(lcProxy) << "Proxy auth required for" << key << proxy.type(); + qCInfo(lcProxy) << "Proxy auth required for" << key << proxy.type(); // If we already had a username but auth still failed, // invalidate the old credentials! Unfortunately, authenticator->user() @@ -107,7 +107,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( if (!_waitingForDialog && !_waitingForKeychain && (!authenticator->user().isEmpty() || (sending_qnam && _gaveCredentialsTo.contains(sending_qnam)))) { - qCDebug(lcProxy) << "invalidating old creds" << key; + qCInfo(lcProxy) << "invalidating old creds" << key; _username.clear(); _password.clear(); invalidated = true; @@ -126,7 +126,7 @@ void ProxyAuthHandler::handleProxyAuthenticationRequired( } } - qCDebug(lcProxy) << "got creds for" << _proxy; + qCInfo(lcProxy) << "got creds for" << _proxy; authenticator->setUser(_username); authenticator->setPassword(_password); sending_qnam = qnam_alive.data(); @@ -166,7 +166,7 @@ bool ProxyAuthHandler::getCredsFromDialog() --_waitingForDialog; if (_dialog && _dialog->result() == QDialog::Accepted) { - qCDebug(lcProxy) << "got creds for" << _proxy << "from dialog"; + qCInfo(lcProxy) << "got creds for" << _proxy << "from dialog"; _username = _dialog->username(); _password = _dialog->password(); return true; @@ -213,14 +213,14 @@ bool ProxyAuthHandler::getCredsFromKeychain() --_waitingForKeychain; if (_readPasswordJob->error() == NoError) { - qCDebug(lcProxy) << "got creds for" << _proxy << "from keychain"; + qCInfo(lcProxy) << "got creds for" << _proxy << "from keychain"; _password = _readPasswordJob->textData(); return true; } _username.clear(); if (_readPasswordJob->error() != EntryNotFound) { - qCDebug(lcProxy) << "ReadPasswordJob failed with" << _readPasswordJob->errorString(); + qCWarning(lcProxy) << "ReadPasswordJob failed with" << _readPasswordJob->errorString(); } return false; } @@ -233,7 +233,7 @@ void ProxyAuthHandler::storeCredsInKeychain() return; } - qCDebug(lcProxy) << "storing" << _proxy; + qCInfo(lcProxy) << "storing" << _proxy; _settings->setValue(keychainUsernameKey(), _username); @@ -256,7 +256,7 @@ void ProxyAuthHandler::storeCredsInKeychain() job->deleteLater(); if (job->error() != NoError) { - qCDebug(lcProxy) << "WritePasswordJob failed with" << job->errorString(); + qCWarning(lcProxy) << "WritePasswordJob failed with" << job->errorString(); } } diff --git a/src/gui/servernotificationhandler.cpp b/src/gui/servernotificationhandler.cpp index bb28f4f744..62ba5e973e 100644 --- a/src/gui/servernotificationhandler.cpp +++ b/src/gui/servernotificationhandler.cpp @@ -44,7 +44,7 @@ void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr) // not yet valid, its assumed that notifications are available. if( ptr->account()->capabilities().isValid() ) { if( ! ptr->account()->capabilities().notificationsAvailable() ) { - qCDebug(lcServerNotification) << "Account" << ptr->account()->displayName() << "does not have notifications enabled."; + qCInfo(lcServerNotification) << "Account" << ptr->account()->displayName() << "does not have notifications enabled."; deleteLater(); return; } @@ -62,7 +62,7 @@ void ServerNotificationHandler::slotFetchNotifications(AccountState *ptr) void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument& json, int statusCode) { if( statusCode != 200 ) { - qCDebug(lcServerNotification) << "Notifications failed with status code " << statusCode; + qCWarning(lcServerNotification) << "Notifications failed with status code " << statusCode; deleteLater(); return; } diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp index 2889379c01..3ad8eed321 100644 --- a/src/gui/sharedialog.cpp +++ b/src/gui/sharedialog.cpp @@ -144,7 +144,7 @@ void ShareDialog::slotMaxSharingPermissionsReceived(const QVariantMap & result) const QVariant receivedPermissions = result["share-permissions"]; if (!receivedPermissions.toString().isEmpty()) { _maxSharingPermissions = static_cast(receivedPermissions.toInt()); - qCDebug(lcSharing) << "Received sharing permissions for" << _sharePath << _maxSharingPermissions; + qCInfo(lcSharing) << "Received sharing permissions for" << _sharePath << _maxSharingPermissions; } showSharingUi(); @@ -208,7 +208,7 @@ void ShareDialog::showSharingUi() void ShareDialog::slotThumbnailFetched(const int &statusCode, const QByteArray &reply) { if (statusCode != 200) { - qCDebug(lcSharing) << "Thumbnail status code: " << statusCode; + qCWarning(lcSharing) << "Thumbnail status code: " << statusCode; return; } diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp index 4885fff5af..dcdff486a9 100644 --- a/src/gui/sharelinkwidget.cpp +++ b/src/gui/sharelinkwidget.cpp @@ -118,7 +118,7 @@ ShareLinkWidget::ShareLinkWidget(AccountPtr account, // // _ui->checkBox_shareLink->setEnabled(false); // uploadExternalFile(); - qCDebug(lcSharing) << "Unable to share files not in a sync folder."; + qCWarning(lcSharing) << "Unable to share files not in a sync folder."; return; } @@ -181,7 +181,7 @@ void ShareLinkWidget::getShares() void ShareLinkWidget::slotSharesFetched(const QList> &shares) { const QString versionString = _account->serverVersion(); - qCDebug(lcSharing) << versionString << "Fetched" << shares.count() << "shares"; + qCInfo(lcSharing) << versionString << "Fetched" << shares.count() << "shares"; // Preserve the previous selection QString selectedShareId; @@ -590,7 +590,7 @@ void ShareLinkWidget::slotServerError(int code, const QString &message) _pi_password->stopAnimation(); _pi_editing->stopAnimation(); - qCDebug(lcSharing) << "Error from server" << code << message; + qCWarning(lcSharing) << "Error from server" << code << message; displayError(message); } diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp index 45c9a40919..66008b4d15 100644 --- a/src/gui/shareusergroupwidget.cpp +++ b/src/gui/shareusergroupwidget.cpp @@ -295,7 +295,7 @@ void ShareUserGroupWidget::displayError(int code, const QString& message) delete pi; } - qCDebug(lcSharing) << "Sharing error from server" << code << message; + qCWarning(lcSharing) << "Sharing error from server" << code << message; _ui->errorLabel->setText(message); _ui->errorLabel->show(); _ui->shareeLineEdit->setEnabled(true); diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index a2b9bb062e..b79467baa3 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -114,7 +114,7 @@ public: void sendMessage(const QString& message, bool doWait = false) const { - qCDebug(lcSocketApi) << "Sending message: " << message; + qCInfo(lcSocketApi) << "Sending SocketAPI message: " << message << "to" << socket; QString localMessage = message; if( ! localMessage.endsWith(QLatin1Char('\n'))) { localMessage.append(QLatin1Char('\n')); @@ -126,7 +126,7 @@ public: socket->waitForBytesWritten(1000); } if( sent != bytesToSend.length() ) { - qCDebug(lcSocketApi) << "WARN: Could not send all data on socket for " << localMessage; + qCWarning(lcSocketApi) << "Could not send all data on socket for " << localMessage; } } @@ -183,7 +183,7 @@ SocketApi::SocketApi(QObject* parent) #endif socketPath = runtimeDir + "/" + Theme::instance()->appName() + "/socket"; } else { - qCDebug(lcSocketApi) << "An unexpected system detected"; + qCWarning(lcSocketApi) << "An unexpected system detected, this probably won't work."; } SocketApiServer::removeServer(socketPath); @@ -197,9 +197,9 @@ SocketApi::SocketApi(QObject* parent) } } if(!_localServer.listen(socketPath)) { - qCDebug(lcSocketApi) << "can't start server" << socketPath; + qCWarning(lcSocketApi) << "can't start server" << socketPath; } else { - qCDebug(lcSocketApi) << "server started, listening at " << socketPath; + qCInfo(lcSocketApi) << "server started, listening at " << socketPath; } connect(&_localServer, SIGNAL(newConnection()), this, SLOT(slotNewConnection())); @@ -224,7 +224,7 @@ void SocketApi::slotNewConnection() if( ! socket ) { return; } - qCDebug(lcSocketApi) << "New connection" << socket; + qCInfo(lcSocketApi) << "New connection" << socket; connect(socket, SIGNAL(readyRead()), this, SLOT(slotReadSocket())); connect(socket, SIGNAL(disconnected()), this, SLOT(onLostConnection())); connect(socket, SIGNAL(destroyed(QObject*)), this, SLOT(slotSocketDestroyed(QObject*))); @@ -243,7 +243,7 @@ void SocketApi::slotNewConnection() void SocketApi::onLostConnection() { - qCDebug(lcSocketApi) << "Lost connection " << sender(); + qCInfo(lcSocketApi) << "Lost connection " << sender(); sender()->deleteLater(); } @@ -272,7 +272,7 @@ void SocketApi::slotReadSocket() if(indexOfMethod != -1) { staticMetaObject.method(indexOfMethod).invoke(this, Q_ARG(QString, argument), Q_ARG(SocketListener*, listener)); } else { - qCDebug(lcSocketApi) << "The command is not supported by this version of the client:" << command << "with argument:" << argument; + qCWarning(lcSocketApi) << "The command is not supported by this version of the client:" << command << "with argument:" << argument; } } } diff --git a/src/gui/sslerrordialog.cpp b/src/gui/sslerrordialog.cpp index 8c7676b7bd..53e90961e6 100644 --- a/src/gui/sslerrordialog.cpp +++ b/src/gui/sslerrordialog.cpp @@ -40,7 +40,7 @@ bool SslDialogErrorHandler::handleErrors(QList errors, const QSslConf { (void) conf; if (!certs) { - qCDebug(lcSslErrorDialog) << "Certs parameter required but is NULL!"; + qCCritical(lcSslErrorDialog) << "Certs parameter required but is NULL!"; return false; } @@ -214,7 +214,7 @@ bool SslErrorDialog::trustConnection() if( _allTrusted ) return true; bool stat = ( _ui->_cbTrustConnect->checkState() == Qt::Checked ); - qCDebug(lcSslErrorDialog) << "SSL-Connection is trusted: " << stat; + qCInfo(lcSslErrorDialog) << "SSL-Connection is trusted: " << stat; return stat; } diff --git a/src/gui/updater/ocupdater.cpp b/src/gui/updater/ocupdater.cpp index 2fd27fa0e2..7bb94ad697 100644 --- a/src/gui/updater/ocupdater.cpp +++ b/src/gui/updater/ocupdater.cpp @@ -67,12 +67,12 @@ void UpdaterScheduler::slotTimerFired() auto checkInterval = cfg.updateCheckInterval(); if( checkInterval != _updateCheckTimer.interval() ) { _updateCheckTimer.setInterval(checkInterval); - qCDebug(lcUpdater) << "Setting new update check interval " << checkInterval; + qCInfo(lcUpdater) << "Setting new update check interval " << checkInterval; } // consider the skipUpdateCheck flag in the config. if( cfg.skipUpdateCheck() ) { - qCDebug(lcUpdater) << "Skipping update check because of config file"; + qCInfo(lcUpdater) << "Skipping update check because of config file"; return; } @@ -123,14 +123,14 @@ void OCUpdater::backgroundCheckForUpdate() case UpToDate: case DownloadFailed: case DownloadTimedOut: - qCDebug(lcUpdater) << "checking for available update"; + qCInfo(lcUpdater) << "Checking for available update"; checkForUpdate(); break; case DownloadComplete: - qCDebug(lcUpdater) << "Update is downloaded, skip new check."; + qCInfo(lcUpdater) << "Update is downloaded, skip new check."; break; case UpdateOnlyAvailableThroughSystem: - qCDebug(lcUpdater) << "Update is only available through system, skip check."; + qCInfo(lcUpdater) << "Update is only available through system, skip check."; break; } } @@ -188,7 +188,7 @@ void OCUpdater::slotStartInstaller() QString updateFile = settings.value(updateAvailableC).toString(); settings.setValue(autoUpdateAttemptedC, true); settings.sync(); - qCDebug(lcUpdater) << "Running updater" << updateFile; + qCInfo(lcUpdater) << "Running updater" << updateFile; QProcess::startDetached(updateFile, QStringList() << "/S" << "/launch"); } @@ -223,7 +223,7 @@ void OCUpdater::slotVersionInfoArrived() QNetworkReply *reply = qobject_cast(sender()); reply->deleteLater(); if( reply->error() != QNetworkReply::NoError ) { - qCDebug(lcUpdater) << "Failed to reach version check url: " << reply->errorString(); + qCWarning(lcUpdater) << "Failed to reach version check url: " << reply->errorString(); return; } @@ -234,7 +234,7 @@ void OCUpdater::slotVersionInfoArrived() if( ok ) { versionInfoArrived(_updateInfo); } else { - qCDebug(lcUpdater) << "Could not parse update information."; + qCWarning(lcUpdater) << "Could not parse update information."; } } @@ -272,7 +272,7 @@ void NSISUpdater::slotDownloadFinished() _file->close(); QFile::copy(_file->fileName(), _targetFile); setDownloadState(DownloadComplete); - qCDebug(lcUpdater) << "Downloaded" << url.toString() << "to" << _targetFile; + qCInfo(lcUpdater) << "Downloaded" << url.toString() << "to" << _targetFile; ConfigFile cfg; QSettings settings(cfg.configFile(), QSettings::IniFormat); settings.setValue(updateTargetVersionC, updateInfo().version()); @@ -290,7 +290,7 @@ void NSISUpdater::versionInfoArrived(const UpdateInfo &info) || infoVersion <= currVersion || infoVersion <= seenVersion) { - qCDebug(lcUpdater) << "Client is on latest version!"; + qCInfo(lcUpdater) << "Client is on latest version!"; setDownloadState(UpToDate); } else { QString url = info.downloadUrl(); @@ -457,7 +457,7 @@ void PassiveUpdateNotifier::versionInfoArrived(const UpdateInfo &info) if( info.version().isEmpty() || currentVer >= remoteVer ) { - qCDebug(lcUpdater) << "Client is on latest version!"; + qCInfo(lcUpdater) << "Client is on latest version!"; setDownloadState(UpToDate); } else { setDownloadState(UpdateOnlyAvailableThroughSystem); diff --git a/src/gui/updater/sparkleupdater_mac.mm b/src/gui/updater/sparkleupdater_mac.mm index 61ac289cc2..f90bdbbdc0 100644 --- a/src/gui/updater/sparkleupdater_mac.mm +++ b/src/gui/updater/sparkleupdater_mac.mm @@ -114,7 +114,7 @@ bool autoUpdaterAllowed() if ([expectedPath isEqualTo:bundlePath]) { return true; } - qCDebug(lcUpdater) << "ERROR: We are not in /Applications, won't check for update!"; + qCWarning(lcUpdater) << "We are not in /Applications, won't check for update!"; return false; } diff --git a/src/gui/updater/updater.cpp b/src/gui/updater/updater.cpp index a6bdd82d74..de9e339c71 100644 --- a/src/gui/updater/updater.cpp +++ b/src/gui/updater/updater.cpp @@ -89,7 +89,7 @@ Updater *Updater::create() updateBaseUrl = QUrl(QLatin1String(APPLICATION_UPDATE_URL)); } if (!updateBaseUrl.isValid() || updateBaseUrl.host() == ".") { - qCDebug(lcUpdater) << "Not a valid updater URL, will not do update check"; + qCWarning(lcUpdater) << "Not a valid updater URL, will not do update check"; return 0; } updateBaseUrl = addQueryParams(updateBaseUrl); diff --git a/src/libsync/abstractnetworkjob.cpp b/src/libsync/abstractnetworkjob.cpp index 26f33c9cdf..c62a3ae37a 100644 --- a/src/libsync/abstractnetworkjob.cpp +++ b/src/libsync/abstractnetworkjob.cpp @@ -148,14 +148,14 @@ void AbstractNetworkJob::slotFinished() _timer.stop(); if( _reply->error() == QNetworkReply::SslHandshakeFailedError ) { - qCDebug(lcNetworkJob) << "SslHandshakeFailedError: " << errorString() << " : can be caused by a webserver wanting SSL client certificates"; + qCWarning(lcNetworkJob) << "SslHandshakeFailedError: " << errorString() << " : can be caused by a webserver wanting SSL client certificates"; } if( _reply->error() != QNetworkReply::NoError ) { - qCDebug(lcNetworkJob) << _reply->error() << errorString() + qCWarning(lcNetworkJob) << _reply->error() << errorString() << _reply->attribute(QNetworkRequest::HttpStatusCodeAttribute); if (_reply->error() == QNetworkReply::ProxyAuthenticationRequiredError) { - qCDebug(lcNetworkJob) << _reply->rawHeader("Proxy-Authenticate"); + qCWarning(lcNetworkJob) << _reply->rawHeader("Proxy-Authenticate"); } emit networkError(_reply); } @@ -182,7 +182,7 @@ void AbstractNetworkJob::slotFinished() qCWarning(lcNetworkJob) << this << "cannot redirect request: could not detect original verb"; } else { // Create the redirected request and send it - qCDebug(lcNetworkJob) << "Redirecting" << verb << requestedUrl << redirectUrl; + qCInfo(lcNetworkJob) << "Redirecting" << verb << requestedUrl << redirectUrl; resetTimeout(); if (_requestBody) { _requestBody->seek(0); @@ -203,6 +203,7 @@ void AbstractNetworkJob::slotFinished() bool discard = finished(); if (discard) { + qCDebug(lcNetworkJob) << "Network job" << metaObject()->className() << "finished for" << path(); deleteLater(); } } @@ -259,7 +260,7 @@ void AbstractNetworkJob::start() const QString displayUrl = QString( "%1://%2%3").arg(url.scheme()).arg(url.host()).arg(url.path()); QString parentMetaObjectName = parent() ? parent()->metaObject()->className() : ""; - qCDebug(lcNetworkJob) << metaObject()->className() << "created for" << displayUrl << "+" << path() << parentMetaObjectName; + qCInfo(lcNetworkJob) << metaObject()->className() << "created for" << displayUrl << "+" << path() << parentMetaObjectName; } void AbstractNetworkJob::slotTimeout() diff --git a/src/libsync/account.cpp b/src/libsync/account.cpp index 273ca24c43..7e183ecb63 100644 --- a/src/libsync/account.cpp +++ b/src/libsync/account.cpp @@ -328,13 +328,13 @@ void Account::slotHandleSslErrors(QNetworkReply *reply , QList errors // If all certs have previously been rejected by the user, don't ask again. if( allPreviouslyRejected ) { - qCDebug(lcAccount) << out << "Certs not trusted by user decision, returning."; + qCInfo(lcAccount) << out << "Certs not trusted by user decision, returning."; return; } QList approvedCerts; if (_sslErrorHandler.isNull() ) { - qCDebug(lcAccount) << out << "called without valid SSL error handler for account" << url(); + qCWarning(lcAccount) << out << "called without valid SSL error handler for account" << url(); return; } @@ -352,7 +352,7 @@ void Account::slotHandleSslErrors(QNetworkReply *reply , QList errors addApprovedCerts(approvedCerts); emit wantsAccountSaved(this); // all ssl certs are known and accepted. We can ignore the problems right away. - qCDebug(lcAccount) << out << "Certs are known and trusted! This is not an actual error."; + qCInfo(lcAccount) << out << "Certs are known and trusted! This is not an actual error."; // Warning: Do *not* use ignoreSslErrors() (without args) here: // it permanently ignores all SSL errors for this host, even diff --git a/src/libsync/asserts.h b/src/libsync/asserts.h index 19b00df929..5e02cf7308 100644 --- a/src/libsync/asserts.h +++ b/src/libsync/asserts.h @@ -6,7 +6,7 @@ #if defined(QT_FORCE_ASSERTS) || !defined(QT_NO_DEBUG) #define OC_ASSERT_MSG qFatal #else -#define OC_ASSERT_MSG qWarning +#define OC_ASSERT_MSG qCritical #endif // For overloading macros by argument count diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index 8b85be4ed6..6e65d0b44a 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -297,7 +297,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired() int jobCount = _downloadJobList.count(); qint64 quota = relativeLimitProgressDifference * (downloadLimitPercent / 100.0); if (quota > 20*1024) { - qCDebug(lcBandwidthManager) << "======== ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20*1024; + qCInfo(lcBandwidthManager) << "ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20*1024; quota -= 20*1024; } qint64 quotaPerJob = quota / jobCount + 1.0; @@ -350,7 +350,7 @@ void BandwidthManager::relativeDownloadDelayTimerExpired() void BandwidthManager::switchingTimerExpired() { qint64 newUploadLimit = _propagator->_uploadLimit.fetchAndAddAcquire(0); if (newUploadLimit != _currentUploadLimit) { - qCDebug(lcBandwidthManager) << "Upload Bandwidth limit changed" << _currentUploadLimit << newUploadLimit; + qCInfo(lcBandwidthManager) << "Upload Bandwidth limit changed" << _currentUploadLimit << newUploadLimit; _currentUploadLimit = newUploadLimit; Q_FOREACH(UploadDevice *ud, _relativeUploadDeviceList) { if (newUploadLimit == 0) { @@ -367,7 +367,7 @@ void BandwidthManager::switchingTimerExpired() { } qint64 newDownloadLimit = _propagator->_downloadLimit.fetchAndAddAcquire(0); if (newDownloadLimit != _currentDownloadLimit) { - qCDebug(lcBandwidthManager) << "Download Bandwidth limit changed" << _currentDownloadLimit << newDownloadLimit; + qCInfo(lcBandwidthManager) << "Download Bandwidth limit changed" << _currentDownloadLimit << newDownloadLimit; _currentDownloadLimit = newDownloadLimit; Q_FOREACH(GETFileJob *j, _downloadJobList) { if (usingAbsoluteDownloadLimit()) { diff --git a/src/libsync/checksums.cpp b/src/libsync/checksums.cpp index c207a5b64d..4498b4b7bb 100644 --- a/src/libsync/checksums.cpp +++ b/src/libsync/checksums.cpp @@ -158,7 +158,7 @@ QByteArray ComputeChecksum::computeNow(const QString& filePath, const QByteArray #endif // for an unknown checksum or no checksum, we're done right now if( !checksumType.isEmpty() ) { - qCDebug(lcChecksums) << "Unknown checksum type:" << checksumType; + qCWarning(lcChecksums) << "Unknown checksum type:" << checksumType; } return QByteArray(); } @@ -188,7 +188,7 @@ void ValidateChecksumHeader::start(const QString& filePath, const QByteArray& ch } if( !parseChecksumHeader(checksumHeader, &_expectedChecksumType, &_expectedChecksum) ) { - qCDebug(lcChecksums) << "Checksum header malformed:" << checksumHeader; + qCWarning(lcChecksums) << "Checksum header malformed:" << checksumHeader; emit validationFailed(tr("The checksum header is malformed.")); return; } @@ -238,13 +238,13 @@ QByteArray CSyncChecksumHook::compute(const QString& path, int checksumTypeId) { QByteArray checksumType = _journal->getChecksumType(checksumTypeId); if (checksumType.isEmpty()) { - qCDebug(lcChecksums) << "Checksum type" << checksumTypeId << "not found"; + qCWarning(lcChecksums) << "Checksum type" << checksumTypeId << "not found"; return QByteArray(); } QByteArray checksum = ComputeChecksum::computeNow(path, checksumType); if (checksum.isNull()) { - qCDebug(lcChecksums) << "Failed to compute checksum" << checksumType << "for" << path; + qCWarning(lcChecksums) << "Failed to compute checksum" << checksumType << "for" << path; return QByteArray(); } diff --git a/src/libsync/clientproxy.cpp b/src/libsync/clientproxy.cpp index cebd5b8261..c78c59db69 100644 --- a/src/libsync/clientproxy.cpp +++ b/src/libsync/clientproxy.cpp @@ -74,23 +74,23 @@ void ClientProxy::setupQtProxyFromConfig() switch(proxyType) { case QNetworkProxy::NoProxy: - qCDebug(lcClientProxy) << "Set proxy configuration to use NO proxy"; + qCInfo(lcClientProxy) << "Set proxy configuration to use NO proxy"; QNetworkProxyFactory::setUseSystemConfiguration(false); QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy); break; case QNetworkProxy::DefaultProxy: - qCDebug(lcClientProxy) << "Set proxy configuration to use system configuration"; + qCInfo(lcClientProxy) << "Set proxy configuration to use system configuration"; QNetworkProxyFactory::setUseSystemConfiguration(true); break; case QNetworkProxy::Socks5Proxy: proxy.setType(QNetworkProxy::Socks5Proxy); - qCDebug(lcClientProxy) << "Set proxy configuration to SOCKS5" << printQNetworkProxy(proxy); + qCInfo(lcClientProxy) << "Set proxy configuration to SOCKS5" << printQNetworkProxy(proxy); QNetworkProxyFactory::setUseSystemConfiguration(false); QNetworkProxy::setApplicationProxy(proxy); break; case QNetworkProxy::HttpProxy: proxy.setType(QNetworkProxy::HttpProxy); - qCDebug(lcClientProxy) << "Set proxy configuration to HTTP" << printQNetworkProxy(proxy); + qCInfo(lcClientProxy) << "Set proxy configuration to HTTP" << printQNetworkProxy(proxy); QNetworkProxyFactory::setUseSystemConfiguration(false); QNetworkProxy::setApplicationProxy(proxy); break; diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 458fc9f713..22a500e5ca 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -108,7 +108,7 @@ bool ConfigFile::setConfDir(const QString &value) } if( fi.exists() && fi.isDir() ) { dirPath = fi.absoluteFilePath(); - qCDebug(lcConfigFile) << "** Using custom config dir " << dirPath; + qCInfo(lcConfigFile) << "Using custom config dir " << dirPath; _confDir=dirPath; return true; } @@ -360,7 +360,7 @@ int ConfigFile::remotePollInterval( const QString& connection ) const int remoteInterval = settings.value( QLatin1String(remotePollIntervalC), DEFAULT_REMOTE_POLL_INTERVAL ).toInt(); if( remoteInterval < 5000) { - qCDebug(lcConfigFile) << "Remote Interval is less than 5 seconds, reverting to" << DEFAULT_REMOTE_POLL_INTERVAL; + qCWarning(lcConfigFile) << "Remote Interval is less than 5 seconds, reverting to" << DEFAULT_REMOTE_POLL_INTERVAL; remoteInterval = DEFAULT_REMOTE_POLL_INTERVAL; } return remoteInterval; @@ -372,7 +372,7 @@ void ConfigFile::setRemotePollInterval(int interval, const QString &connection ) if( connection.isEmpty() ) con = defaultConnection(); if( interval < 5000 ) { - qCDebug(lcConfigFile) << "Remote Poll interval of " << interval << " is below five seconds."; + qCWarning(lcConfigFile) << "Remote Poll interval of " << interval << " is below five seconds."; return; } QSettings settings(configFile(), QSettings::IniFormat); @@ -393,7 +393,7 @@ quint64 ConfigFile::forceSyncInterval(const QString& connection) const quint64 defaultInterval = 2 * 60 * 60 * 1000ull; // 2h quint64 interval = settings.value( QLatin1String(forceSyncIntervalC), defaultInterval ).toULongLong(); if( interval < pollInterval) { - qCDebug(lcConfigFile) << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval; + qCWarning(lcConfigFile) << "Force sync interval is less than the remote poll inteval, reverting to" << pollInterval; interval = pollInterval; } return interval; @@ -409,7 +409,7 @@ quint64 ConfigFile::notificationRefreshInterval(const QString& connection) const quint64 defaultInterval = 5 * 60 * 1000ull; // 5 minutes quint64 interval = settings.value( QLatin1String(notificationRefreshIntervalC), defaultInterval ).toULongLong(); if( interval < 60*1000ull) { - qCDebug(lcConfigFile) << "notification refresh interval smaller than one minute, setting to one minute"; + qCWarning(lcConfigFile) << "Notification refresh interval smaller than one minute, setting to one minute"; interval = 60*1000ull; } return interval; @@ -427,7 +427,7 @@ int ConfigFile::updateCheckInterval( const QString& connection ) const int minInterval = 1000*60*5; if( interval < minInterval) { - qCDebug(lcConfigFile) << "Update check interval less than five minutes, setting " << minInterval; + qCWarning(lcConfigFile) << "Update check interval less than five minutes, setting " << minInterval; interval = minInterval; } return interval; diff --git a/src/libsync/connectionvalidator.cpp b/src/libsync/connectionvalidator.cpp index c5bce6734e..bac43e3aa5 100644 --- a/src/libsync/connectionvalidator.cpp +++ b/src/libsync/connectionvalidator.cpp @@ -93,14 +93,14 @@ void ConnectionValidator::checkServerAndAuth() void ConnectionValidator::systemProxyLookupDone(const QNetworkProxy &proxy) { if (!_account) { - qCDebug(lcConnectionValidator) << "Bailing out, Account had been deleted"; + qCWarning(lcConnectionValidator) << "Bailing out, Account had been deleted"; return; } if (proxy.type() != QNetworkProxy::NoProxy) { - qCDebug(lcConnectionValidator) << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy); + qCInfo(lcConnectionValidator) << "Setting QNAM proxy to be system proxy" << printQNetworkProxy(proxy); } else { - qCDebug(lcConnectionValidator) << "No system proxy set by OS"; + qCInfo(lcConnectionValidator) << "No system proxy set by OS"; } _account->networkAccessManager()->setProxy(proxy); @@ -127,7 +127,7 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QJsonObject &inf QString serverVersion = CheckServerJob::version(info); // status.php was found. - qCDebug(lcConnectionValidator) << "** Application: ownCloud found: " + qCInfo(lcConnectionValidator) << "** Application: ownCloud found: " << url << " with version " << CheckServerJob::versionString(info) << "(" << serverVersion << ")"; @@ -152,7 +152,7 @@ void ConnectionValidator::slotStatusFound(const QUrl&url, const QJsonObject &inf void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply) { auto job = qobject_cast(sender()); - qCDebug(lcConnectionValidator) << reply->error() << job->errorString() << reply->peek(1024); + qCWarning(lcConnectionValidator) << reply->error() << job->errorString() << reply->peek(1024); if (!_account->credentials()->ready()) { // This could be needed for SSL client certificates // We need to load them from keychain and try @@ -201,8 +201,7 @@ void ConnectionValidator::slotAuthFailed(QNetworkReply *reply) if( reply->error() == QNetworkReply::AuthenticationRequiredError || !_account->credentials()->stillValid(reply)) { - qCDebug(lcConnectionValidator) << reply->error() << job->errorString(); - qCDebug(lcConnectionValidator) << "******** Password is wrong!"; + qCWarning(lcConnectionValidator) << "******** Password is wrong!" << reply->error() << job->errorString(); _errors << tr("The provided credentials are not correct"); stat = CredentialsMissingOrWrong; @@ -241,7 +240,7 @@ void ConnectionValidator::checkServerCapabilities() void ConnectionValidator::slotCapabilitiesRecieved(const QJsonDocument &json) { auto caps = json.object().value("ocs").toObject().value("data").toObject().value("capabilities").toObject(); - qCDebug(lcConnectionValidator) << "Server capabilities" << caps; + qCInfo(lcConnectionValidator) << "Server capabilities" << caps; _account->setCapabilities(caps.toVariantMap()); // New servers also report the version in the capabilities diff --git a/src/libsync/creds/abstractcredentials.cpp b/src/libsync/creds/abstractcredentials.cpp index 233ca9ceac..4fe1541846 100644 --- a/src/libsync/creds/abstractcredentials.cpp +++ b/src/libsync/creds/abstractcredentials.cpp @@ -38,11 +38,11 @@ QString AbstractCredentials::keychainKey(const QString &url, const QString &user { QString u(url); if( u.isEmpty() ) { - qCDebug(lcCredentials) << "Empty url in keyChain, error!"; + qCWarning(lcCredentials) << "Empty url in keyChain, error!"; return QString::null; } if( user.isEmpty() ) { - qCDebug(lcCredentials) << "Error: User is empty!"; + qCWarning(lcCredentials) << "Error: User is empty!"; return QString::null; } diff --git a/src/libsync/creds/httpcredentials.cpp b/src/libsync/creds/httpcredentials.cpp index 56d67c29a6..6355d47885 100644 --- a/src/libsync/creds/httpcredentials.cpp +++ b/src/libsync/creds/httpcredentials.cpp @@ -202,7 +202,7 @@ void HttpCredentials::slotReadClientKeyPEMJobDone(QKeychain::Job* incoming) } #endif if (_clientSslKey.isNull()) { - qCDebug(lcHttpCredentials) << "Warning: Could not load SSL key into Qt!"; + qCWarning(lcHttpCredentials) << "Could not load SSL key into Qt!"; } } @@ -232,7 +232,7 @@ void HttpCredentials::slotReadJobDone(QKeychain::Job *incomingJob) _password = job->textData(); if( _user.isEmpty()) { - qCDebug(lcHttpCredentials) << "Strange: User is empty!"; + qCWarning(lcHttpCredentials) << "Strange: User is empty!"; } QKeychain::Error error = job->error(); @@ -268,7 +268,7 @@ void HttpCredentials::invalidateToken() const QString kck = keychainKey(_account->url().toString(), _user); if( kck.isEmpty() ) { - qCDebug(lcHttpCredentials) << "InvalidateToken: User is empty, bailing out!"; + qCWarning(lcHttpCredentials) << "InvalidateToken: User is empty, bailing out!"; return; } @@ -363,7 +363,7 @@ void HttpCredentials::slotWriteJobDone(QKeychain::Job *job) case NoError: break; default: - qCDebug(lcHttpCredentials) << "Error while writing password" << job->errorString(); + qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString(); } WritePasswordJob *wjob = qobject_cast(job); wjob->deleteLater(); @@ -374,7 +374,7 @@ void HttpCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* a Q_UNUSED(authenticator) // Because of issue #4326, we need to set the login and password manually at every requests // Thus, if we reach this signal, those credentials were invalid and we terminate. - qCDebug(lcHttpCredentials) << "Stop request: Authentication failed for " << reply->url().toString(); + qCWarning(lcHttpCredentials) << "Stop request: Authentication failed for " << reply->url().toString(); reply->setProperty(authenticationFailedC, true); reply->close(); } diff --git a/src/libsync/creds/tokencredentials.cpp b/src/libsync/creds/tokencredentials.cpp index 221d830dd2..53b2cbc89d 100644 --- a/src/libsync/creds/tokencredentials.cpp +++ b/src/libsync/creds/tokencredentials.cpp @@ -133,7 +133,7 @@ bool TokenCredentials::stillValid(QNetworkReply *reply) void TokenCredentials::invalidateToken() { - qCDebug(lcTokenCredentials) << "Invalidating token"; + qCInfo(lcTokenCredentials) << "Invalidating token"; _ready = false; _account->clearCookieJar(); _token = QString(); @@ -157,7 +157,7 @@ void TokenCredentials::slotAuthentication(QNetworkReply* reply, QAuthenticator* // we cannot use QAuthenticator, because it sends username and passwords with latin1 // instead of utf8 encoding. Instead, we send it manually. Thus, if we reach this signal, // those credentials were invalid and we terminate. - qCDebug(lcTokenCredentials) << "Stop request: Authentication failed for " << reply->url().toString(); + qCWarning(lcTokenCredentials) << "Stop request: Authentication failed for " << reply->url().toString(); reply->setProperty(authenticationFailedC, true); reply->close(); } diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index c9c78e73fa..cbb2d37787 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -287,7 +287,6 @@ static csync_vio_file_stat_t* propertyMapToFileStat(const QMap csync_vio_file_stat_t* file_stat = csync_vio_file_stat_new(); for (auto it = map.constBegin(); it != map.constEnd(); ++it) { - qCDebug(lcDiscovery) << "Property key:" << it.key() << "with value:" << it.value(); QString property = it.key(); QString value = it.value(); if (property == "resourcetype") { @@ -367,7 +366,7 @@ void DiscoverySingleDirectoryJob::directoryListingIteratedSlot(QString file, con FileStatPointer file_stat(propertyMapToFileStat(map)); file_stat->name = strdup(file.toUtf8()); if (!file_stat->etag || strlen(file_stat->etag) == 0) { - qCDebug(lcDiscovery) << "WARNING: etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen."; + qCCritical(lcDiscovery) << "etag of" << file_stat->name << "is" << file_stat->etag << " This must not happen."; } if (_isExternalStorage) { /* All the entries in a external storage have 'M' in their permission. However, for all @@ -417,7 +416,7 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot(QNetworkReply *r) QString httpReason = r->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString(); QString msg = r->errorString(); int errnoCode = EIO; // Something went wrong - qCDebug(lcDiscovery) << r->errorString() << httpCode << r->error(); + qCWarning(lcDiscovery) << "LSCOL job error" << r->errorString() << httpCode << r->error(); if (httpCode != 0 && httpCode != 207) { errnoCode = get_errno_from_http_errcode(httpCode, httpReason); } else if (r->error() != QNetworkReply::NoError) { diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index d6ab41822c..21d9ccf5a8 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -68,7 +68,7 @@ bool FileSystem::fileEquals(const QString& fn1, const QString& fn2) QFile f1(fn1); QFile f2(fn2); if (!f1.open(QIODevice::ReadOnly) || !f2.open(QIODevice::ReadOnly)) { - qCDebug(lcFileSystem) << "fileEquals: Failed to open " << fn1 << "or" << fn2; + qCWarning(lcFileSystem) << "fileEquals: Failed to open " << fn1 << "or" << fn2; return false; } @@ -180,7 +180,7 @@ time_t FileSystem::getModTime(const QString &filename) && (stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_MTIME)) { result = stat->mtime; } else { - qCDebug(lcFileSystem) << "Could not get modification time for" << filename + qCWarning(lcFileSystem) << "Could not get modification time for" << filename << "with csync, using QFileInfo"; result = Utility::qDateTimeToTime_t(QFileInfo(filename).lastModified()); } @@ -195,7 +195,7 @@ bool FileSystem::setModTime(const QString& filename, time_t modTime) times[0].tv_usec = times[1].tv_usec = 0; int rc = c_utimes(filename.toUtf8().data(), times); if (rc != 0) { - qCDebug(lcFileSystem) << "Error setting mtime for" << filename + qCWarning(lcFileSystem) << "Error setting mtime for" << filename << "failed: rc" << rc << ", errno:" << errno; return false; } @@ -243,7 +243,7 @@ bool FileSystem::rename(const QString &originFileName, } if (!success) { - qCDebug(lcFileSystem) << "FAIL: renaming file" << originFileName + qCWarning(lcFileSystem) << "Error renaming file" << originFileName << "to" << destinationFileName << "failed: " << error; if (errorString) { @@ -268,7 +268,7 @@ bool FileSystem::verifyFileUnchanged(const QString& fileName, const qint64 actualSize = getSize(fileName); const time_t actualMtime = getModTime(fileName); if (actualSize != previousSize || actualMtime != previousMtime) { - qCDebug(lcFileSystem) << "File" << fileName << "has changed:" + qCInfo(lcFileSystem) << "File" << fileName << "has changed:" << "size: " << previousSize << "<->" << actualSize << ", mtime: " << previousMtime << "<->" << actualMtime; return false; @@ -311,7 +311,7 @@ bool FileSystem::uncheckedRenameReplace(const QString& originFileName, bool destExists = fileExists(destinationFileName); if( destExists && !QFile::remove(destinationFileName) ) { *errorString = orig.errorString(); - qCDebug(lcFileSystem) << "Target file could not be removed."; + qCWarning(lcFileSystem) << "Target file could not be removed."; success = false; } if( success ) { @@ -320,7 +320,7 @@ bool FileSystem::uncheckedRenameReplace(const QString& originFileName, #endif if (!success) { *errorString = orig.errorString(); - qCDebug(lcFileSystem) << "FAIL: renaming temp file to final failed: " << *errorString ; + qCWarning(lcFileSystem) << "Renaming temp file to final failed: " << *errorString ; return false; } @@ -344,7 +344,7 @@ bool FileSystem::uncheckedRenameReplace(const QString& originFileName, (LPWSTR)&string, 0, NULL); *errorString = QString::fromWCharArray(string); - qCDebug(lcFileSystem) << "FAIL: renaming temp file to final failed: " << *errorString; + qCWarning(lcFileSystem) << "Renaming temp file to final failed: " << *errorString; LocalFree((HLOCAL)string); return false; } @@ -434,7 +434,7 @@ static qint64 getSizeWithCsync(const QString& filename) && (stat->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE)) { result = stat->size; } else { - qCDebug(lcFileSystem) << "Could not get size for" << filename << "with csync"; + qCWarning(lcFileSystem) << "Could not get size for" << filename << "with csync"; } csync_vio_file_stat_destroy(stat); return result; diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 142fd0635f..ca466bc424 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -39,13 +39,14 @@ namespace OCC { -Q_LOGGING_CATEGORY(lcEtag, "sync.networkjob.etag", QtInfoMsg) -Q_LOGGING_CATEGORY(lcLsCol, "sync.networkjob.lscol", QtInfoMsg) -Q_LOGGING_CATEGORY(lcCheckServer, "sync.networkjob.checkserver", QtInfoMsg) -Q_LOGGING_CATEGORY(lcPropfind, "sync.networkjob.propfind", QtInfoMsg) -Q_LOGGING_CATEGORY(lcAvatar, "sync.networkjob.avatar", QtInfoMsg) -Q_LOGGING_CATEGORY(lcProppatch, "sync.networkjob.proppatch", QtInfoMsg) -Q_LOGGING_CATEGORY(lcJsonApi, "sync.networkjob.jsonapi", QtInfoMsg) +Q_LOGGING_CATEGORY(lcEtagJob, "sync.networkjob.etag", QtInfoMsg) +Q_LOGGING_CATEGORY(lcLsColJob, "sync.networkjob.lscol", QtInfoMsg) +Q_LOGGING_CATEGORY(lcCheckServerJob, "sync.networkjob.checkserver", QtInfoMsg) +Q_LOGGING_CATEGORY(lcPropfindJob, "sync.networkjob.propfind", QtInfoMsg) +Q_LOGGING_CATEGORY(lcAvatarJob, "sync.networkjob.avatar", QtInfoMsg) +Q_LOGGING_CATEGORY(lcMkColJob, "sync.networkjob.mkcol", QtInfoMsg) +Q_LOGGING_CATEGORY(lcProppatchJob, "sync.networkjob.proppatch", QtInfoMsg) +Q_LOGGING_CATEGORY(lcJsonApiJob, "sync.networkjob.jsonapi", QtInfoMsg) RequestEtagJob::RequestEtagJob(AccountPtr account, const QString &path, QObject *parent) : AbstractNetworkJob(account, path, parent) @@ -79,13 +80,17 @@ void RequestEtagJob::start() sendRequest("PROPFIND", makeDavUrl(path()), req, buf); if( reply()->error() != QNetworkReply::NoError ) { - qCDebug(lcEtag) << "request network error: " << reply()->errorString(); + qCWarning(lcEtagJob) << "request network error: " << reply()->errorString(); } AbstractNetworkJob::start(); } bool RequestEtagJob::finished() { + qCInfo(lcEtagJob) << "Request Etag of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + if (reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) == 207) { // Parse DAV response QXmlStreamReader reader(reply()); @@ -139,6 +144,10 @@ void MkColJob::start() bool MkColJob::finished() { + qCInfo(lcMkColJob) << "MKCOL of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + emit finished(reply()->error()); return true; } @@ -198,7 +207,7 @@ bool LsColXMLParser::parse( const QByteArray& xml, QHash *sizes // but the result will have URL encoding.. QString hrefString = QString::fromUtf8(QByteArray::fromPercentEncoding(reader.readElementText().toUtf8())); if (!hrefString.startsWith(expectedPath)) { - qCDebug(lcLsCol) << "Invalid href" << hrefString << "expected starting with" << expectedPath; + qCWarning(lcLsColJob) << "Invalid href" << hrefString << "expected starting with" << expectedPath; return false; } currentHref = hrefString; @@ -262,10 +271,10 @@ bool LsColXMLParser::parse( const QByteArray& xml, QHash *sizes if (reader.hasError()) { // XML Parser error? Whatever had been emitted before will come as directoryListingIterated - qCDebug(lcLsCol) << "ERROR" << reader.errorString() << xml; + qCWarning(lcLsColJob) << "ERROR" << reader.errorString() << xml; return false; } else if (!insideMultiStatus) { - qCDebug(lcLsCol) << "ERROR no WebDAV response?" << xml; + qCWarning(lcLsColJob) << "ERROR no WebDAV response?" << xml; return false; } else { emit directoryListingSubfolders(folders); @@ -302,7 +311,7 @@ void LsColJob::start() QList properties = _properties; if (properties.isEmpty()) { - qCWarning(lcLsCol) << "Propfind with no properties!"; + qCWarning(lcLsColJob) << "Propfind with no properties!"; } QByteArray propStr; foreach (const QByteArray &prop, properties) { @@ -343,6 +352,10 @@ void LsColJob::start() // not all in one big blob at the end. bool LsColJob::finished() { + qCInfo(lcLsColJob) << "LSCOL of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + QString contentType = reply()->header(QNetworkRequest::ContentTypeHeader).toString(); int httpCode = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (httpCode == 207 && contentType.contains("application/xml; charset=utf-8")) { @@ -396,11 +409,11 @@ void CheckServerJob::start() void CheckServerJob::onTimedOut() { - qCDebug(lcCheckServer) << "TIMEOUT"; + qCWarning(lcCheckServerJob) << "TIMEOUT"; if (reply() && reply()->isRunning()) { emit timeout(reply()->url()); } else if (!reply()) { - qCDebug(lcCheckServer) << "Timeout even there was no reply?"; + qCWarning(lcCheckServerJob) << "Timeout even there was no reply?"; } deleteLater(); } @@ -453,7 +466,7 @@ bool CheckServerJob::finished() if (reply()->request().url().scheme() == QLatin1String("https") && reply()->sslConfiguration().sessionTicket().isEmpty() && reply()->error() == QNetworkReply::NoError) { - qCDebug(lcCheckServer) << "No SSL session identifier / session ticket is used, this might impact sync performance negatively."; + qCWarning(lcCheckServerJob) << "No SSL session identifier / session ticket is used, this might impact sync performance negatively."; } #endif @@ -465,28 +478,28 @@ bool CheckServerJob::finished() _subdirFallback = true; setPath(QLatin1String(owncloudDirC)+QLatin1String(statusphpC)); start(); - qCDebug(lcCheckServer) << "Retrying with" << reply()->url(); + qCInfo(lcCheckServerJob) << "Retrying with" << reply()->url(); return false; } QByteArray body = reply()->peek(4*1024); int httpStatus = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if( body.isEmpty() || httpStatus != 200) { - qCDebug(lcCheckServer) << "error: status.php replied " << httpStatus << body; + qCWarning(lcCheckServerJob) << "error: status.php replied " << httpStatus << body; emit instanceNotFound(reply()); } else { QJsonParseError error; auto status = QJsonDocument::fromJson(body, &error); // empty or invalid response if (error.error != QJsonParseError::NoError || status.isNull()) { - qCDebug(lcCheckServer) << "status.php from server is not valid JSON!" << body << reply()->request().url() << error.errorString(); + qCWarning(lcCheckServerJob) << "status.php from server is not valid JSON!" << body << reply()->request().url() << error.errorString(); } - qCDebug(lcCheckServer) << "status.php returns: " << status << " " << reply()->error() << " Reply: " << reply(); + qCInfo(lcCheckServerJob) << "status.php returns: " << status << " " << reply()->error() << " Reply: " << reply(); if( status.object().contains("installed") ) { emit instanceFound(reply()->url(), status.object()); } else { - qCDebug(lcCheckServer) << "No proper answer on " << reply()->url(); + qCWarning(lcCheckServerJob) << "No proper answer on " << reply()->url(); emit instanceNotFound(reply()); } } @@ -506,7 +519,7 @@ void PropfindJob::start() QList properties = _properties; if (properties.isEmpty()) { - qCWarning(lcLsCol) << "Propfind with no properties!"; + qCWarning(lcLsColJob) << "Propfind with no properties!"; } QNetworkRequest req; // Always have a higher priority than the propagator because we use this from the UI @@ -549,6 +562,10 @@ QList PropfindJob::properties() const bool PropfindJob::finished() { + qCInfo(lcPropfindJob) << "PROPFIND of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + int http_result_code = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (http_result_code == 207) { @@ -576,13 +593,13 @@ bool PropfindJob::finished() } } if (reader.hasError()) { - qCDebug(lcPropfind) << "XML parser error: " << reader.errorString(); + qCWarning(lcPropfindJob) << "XML parser error: " << reader.errorString(); emit finishedWithError(reply()); } else { emit result(items); } } else { - qCDebug(lcPropfind) << "*not* successful, http result code is" << http_result_code + qCWarning(lcPropfindJob) << "*not* successful, http result code is" << http_result_code << (http_result_code == 302 ? reply()->header(QNetworkRequest::LocationHeader).toString() : QLatin1String("")); emit finishedWithError(reply()); } @@ -616,7 +633,7 @@ bool AvatarJob::finished() if( pngData.size() ) { if( avImage.loadFromData(pngData) ) { - qCDebug(lcAvatar) << "Retrieved Avatar pixmap!"; + qCDebug(lcAvatarJob) << "Retrieved Avatar pixmap!"; } } } @@ -635,7 +652,7 @@ ProppatchJob::ProppatchJob(AccountPtr account, const QString &path, QObject *par void ProppatchJob::start() { if (_properties.isEmpty()) { - qCWarning(lcProppatch) << "Proppatch with no properties!"; + qCWarning(lcProppatchJob) << "Proppatch with no properties!"; } QNetworkRequest req; @@ -685,12 +702,16 @@ QMap ProppatchJob::properties() const bool ProppatchJob::finished() { + qCInfo(lcProppatchJob) << "PROPPATCH of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + int http_result_code = reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (http_result_code == 207) { emit success(); } else { - qCDebug(lcProppatch) << "*not* successful, http result code is" << http_result_code + qCWarning(lcProppatchJob) << "*not* successful, http result code is" << http_result_code << (http_result_code == 302 ? reply()->header(QNetworkRequest::LocationHeader).toString() : QLatin1String("")); emit finishedWithError(); } @@ -740,10 +761,14 @@ void JsonApiJob::start() bool JsonApiJob::finished() { + qCInfo(lcJsonApiJob) << "JsonApiJob of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + int statusCode = 0; if (reply()->error() != QNetworkReply::NoError) { - qCWarning(lcJsonApi) << "Network error: " << path() << errorString() << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute); + qCWarning(lcJsonApiJob) << "Network error: " << path() << errorString() << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute); emit jsonReceived(QJsonDocument(), statusCode); return true; } @@ -768,7 +793,7 @@ bool JsonApiJob::finished() auto json = QJsonDocument::fromJson(jsonStr.toUtf8(), &error); // empty or invalid response if (error.error != QJsonParseError::NoError || json.isNull()) { - qCWarning(lcJsonApi) << "invalid JSON!" << jsonStr << error.errorString(); + qCWarning(lcJsonApiJob) << "invalid JSON!" << jsonStr << error.errorString(); emit jsonReceived(json, statusCode); return true; } diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 6559ba2fcc..dc5d9fe1be 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -146,11 +146,11 @@ static SyncJournalErrorBlacklistRecord createBlacklistEntry( entry._ignoreDuration = old._ignoreDuration * 5; if( item._httpErrorCode == 403 ) { - qCDebug(lcPropagator) << "Probably firewall error: " << item._httpErrorCode << ", blacklisting up to 1h only"; + qCWarning(lcPropagator) << "Probably firewall error: " << item._httpErrorCode << ", blacklisting up to 1h only"; entry._ignoreDuration = qMin(entry._ignoreDuration, time_t(60*60)); } else if( item._httpErrorCode == 413 || item._httpErrorCode == 415 ) { - qCDebug(lcPropagator) << "Fatal Error condition" << item._httpErrorCode << ", maximum blacklist ignore time!"; + qCWarning(lcPropagator) << "Fatal Error condition" << item._httpErrorCode << ", maximum blacklist ignore time!"; entry._ignoreDuration = maxBlacklistTime; } @@ -197,7 +197,7 @@ static void blacklistUpdate(SyncJournalDb* journal, SyncFileItem& item) item._status = SyncFileItem::FileIgnored; item._errorString.prepend(PropagateItemJob::tr("Continue blacklisting:") + " "); - qCDebug(lcPropagator) << "blacklisting " << item._file + qCInfo(lcPropagator) << "blacklisting " << item._file << " for " << newEntry._ignoreDuration << ", retry count " << newEntry._retryCount; @@ -207,7 +207,7 @@ static void blacklistUpdate(SyncJournalDb* journal, SyncFileItem& item) // Some soft errors might become louder on repeat occurrence if (item._status == SyncFileItem::SoftError && newEntry._retryCount > 1) { - qCDebug(lcPropagator) << "escalating soft error on " << item._file + qCWarning(lcPropagator) << "escalating soft error on " << item._file << " to normal error, " << item._httpErrorCode; item._status = SyncFileItem::NormalError; return; @@ -264,6 +264,7 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error break; } + qCInfo(lcPropagator) << "Completed propagation of" << _item->destination() << "by" << this << "with status" << _item->_status << "and error:" << _item->_errorString; emit propagator()->itemCompleted(_item); emit finished(_item->_status); @@ -507,8 +508,6 @@ void OwncloudPropagator::start(const SyncFileItemVector& items) connect(_rootJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SLOT(emitFinished(SyncFileItem::Status))); - qCDebug(lcPropagator) << "Using QNAM/HTTP parallel code path"; - scheduleNextJob(); } @@ -564,7 +563,7 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile ) QFileInfo fileInfo(file); if (!fileInfo.exists()) { re = false; - qCDebug(lcPropagator) << "No valid fileinfo"; + qCWarning(lcPropagator) << "No valid fileinfo"; } else { // Need to normalize to composited form because of // https://bugreports.qt-project.org/browse/QTBUG-39622 @@ -586,7 +585,7 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile ) FindClose(hFind); if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) { - qCDebug(lcPropagator) << "Detected case clash between" << file << "and" << realFileName; + qCWarning(lcPropagator) << "Detected case clash between" << file << "and" << realFileName; re = true; } } @@ -622,7 +621,7 @@ bool OwncloudPropagator::hasCaseClashAccessibilityProblem(const QString &relfile if (firstFile != secondFile && QString::compare(firstFile, secondFile, Qt::CaseInsensitive) == 0) { result = true; - qCDebug(lcPropagator) << "Found two filepaths that only differ in case: " << firstFile << secondFile; + qCWarning(lcPropagator) << "Found two filepaths that only differ in case: " << firstFile << secondFile; } } FindClose(hFind); @@ -969,7 +968,7 @@ void CleanupPollsJob::slotPollFinished() deleteLater(); return; } else if (job->_item->_status != SyncFileItem::Success) { - qCDebug(lcCleanupPolls) << "There was an error with file " << job->_item->_file << job->_item->_errorString; + qCWarning(lcCleanupPolls) << "There was an error with file " << job->_item->_file << job->_item->_errorString; } else { if (!_journal->setFileRecord(SyncJournalFileRecord(*job->_item, _localPath + job->_item->_file))) { qCWarning(lcCleanupPolls) << "database error"; diff --git a/src/libsync/owncloudpropagator.h b/src/libsync/owncloudpropagator.h index beae46c2ed..0f42635f1e 100644 --- a/src/libsync/owncloudpropagator.h +++ b/src/libsync/owncloudpropagator.h @@ -35,6 +35,8 @@ namespace OCC { Q_DECLARE_LOGGING_CATEGORY(lcPropagator) +extern "C" const char *csync_instruction_str(enum csync_instructions_e instr); + /** Free disk space threshold below which syncs will abort and not even start. */ qint64 criticalFreeSpaceLimit(); @@ -150,6 +152,9 @@ public: if (_state != NotYetStarted) { return false; } + const char * instruction_str = csync_instruction_str(_item->_instruction); + qCInfo(lcPropagator) << "Starting" << instruction_str << "propagation of" << _item->_file << "by" << this; + _state = Running; QMetaObject::invokeMethod(this, "start"); // We could be in a different thread (neon jobs) return true; diff --git a/src/libsync/ownsql.cpp b/src/libsync/ownsql.cpp index 92e32a8e5e..620e9d5fdc 100644 --- a/src/libsync/ownsql.cpp +++ b/src/libsync/ownsql.cpp @@ -58,13 +58,13 @@ bool SqlDatabase::openHelper( const QString& filename, int sqliteFlags ) SQLITE_DO( sqlite3_open_v2(filename.toUtf8().constData(), &_db, sqliteFlags, 0) ); if( _errId != SQLITE_OK ) { - qCDebug(lcSql) << "Error:" << _error << "for" << filename; + qCWarning(lcSql) << "Error:" << _error << "for" << filename; close(); return false; } if( !_db ) { - qCDebug(lcSql) << "Error: no database for" << filename; + qCWarning(lcSql) << "Error: no database for" << filename; return false; } @@ -79,14 +79,14 @@ bool SqlDatabase::checkDb() SqlQuery quick_check(*this); quick_check.prepare("PRAGMA quick_check;", /*allow_failure=*/true); if( !quick_check.exec() ) { - qCDebug(lcSql) << "Error running quick_check on database"; + qCWarning(lcSql) << "Error running quick_check on database"; return false; } quick_check.next(); QString result = quick_check.stringValue(0); if( result != "ok" ) { - qCDebug(lcSql) << "quick_check returned failure:" << result; + qCWarning(lcSql) << "quick_check returned failure:" << result; return false; } @@ -107,12 +107,12 @@ bool SqlDatabase::openOrCreateReadWrite( const QString& filename ) // When disk space is low, checking the db may fail even though it's fine. qint64 freeSpace = Utility::freeDiskSpace(QFileInfo(filename).dir().absolutePath()); if (freeSpace != -1 && freeSpace < 1000000) { - qCDebug(lcSql) << "Consistency check failed, disk space is low, aborting" << freeSpace; + qCWarning(lcSql) << "Consistency check failed, disk space is low, aborting" << freeSpace; close(); return false; } - qCDebug(lcSql) << "Consistency check failed, removing broken db" << filename; + qCCritical(lcSql) << "Consistency check failed, removing broken db" << filename; close(); QFile::remove(filename); @@ -133,7 +133,7 @@ bool SqlDatabase::openReadOnly( const QString& filename ) } if( !checkDb() ) { - qCDebug(lcSql) << "Consistency check failed in readonly mode, giving up" << filename; + qCWarning(lcSql) << "Consistency check failed in readonly mode, giving up" << filename; close(); return false; } @@ -244,7 +244,10 @@ bool SqlQuery::isPragma() bool SqlQuery::exec() { + qCDebug(lcSql) << "SQL exec" << _sql; + if (!_stmt) { + qCWarning(lcSql) << "Can't exec query, statement unprepared."; return false; } @@ -266,7 +269,9 @@ bool SqlQuery::exec() if (_errId != SQLITE_DONE && _errId != SQLITE_ROW) { _error = QString::fromUtf8(sqlite3_errmsg(_db)); - qCDebug(lcSql) << "Sqlite exec statement error:" << _errId << _error << "in" <<_sql; + qCWarning(lcSql) << "Sqlite exec statement error:" << _errId << _error << "in" <<_sql; + } else { + qCDebug(lcSql) << "Last exec affected" << numRowsAffected() << "rows."; } return (_errId == SQLITE_DONE); // either SQLITE_ROW or SQLITE_DONE } @@ -282,6 +287,8 @@ bool SqlQuery::next() void SqlQuery::bindValue(int pos, const QVariant& value) { + qCDebug(lcSql) << "SQL bind" << pos << value; + int res = -1; if (!_stmt) { ASSERT(false); @@ -337,7 +344,7 @@ void SqlQuery::bindValue(int pos, const QVariant& value) break; } } if (res != SQLITE_OK) { - qCDebug(lcSql) << "ERROR" << value << res; + qCWarning(lcSql) << "ERROR binding SQL value:" << value << "error:" << res; } ASSERT( res == SQLITE_OK ); } diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 2a4acf4655..7d05f3eb9c 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -37,7 +37,7 @@ namespace OCC { -Q_LOGGING_CATEGORY(lcGetFile, "sync.networkjob.get", QtInfoMsg) +Q_LOGGING_CATEGORY(lcGetJob, "sync.networkjob.get", QtInfoMsg) Q_LOGGING_CATEGORY(lcPropagateDownload, "sync.propagator.download", QtInfoMsg) // Always coming in with forward slashes. @@ -93,7 +93,7 @@ void GETFileJob::start() { if (_resumeStart > 0) { _headers["Range"] = "bytes=" + QByteArray::number(_resumeStart) +'-'; _headers["Accept-Ranges"] = "bytes"; - qCDebug(lcGetFile) << "Retry with range " << _headers["Range"]; + qCDebug(lcGetJob) << "Retry with range " << _headers["Range"]; } QNetworkRequest req; @@ -109,13 +109,13 @@ void GETFileJob::start() { } reply()->setReadBufferSize(16 * 1024); // keep low so we can easier limit the bandwidth - qCDebug(lcGetFile) << _bandwidthManager << _bandwidthChoked << _bandwidthLimited; + qCDebug(lcGetJob) << _bandwidthManager << _bandwidthChoked << _bandwidthLimited; if (_bandwidthManager) { _bandwidthManager->registerDownloadJob(this); } if( reply()->error() != QNetworkReply::NoError ) { - qCWarning(lcGetFile) << " Network error: " << errorString(); + qCWarning(lcGetJob) << " Network error: " << errorString(); } connect(reply(), SIGNAL(metaDataChanged()), this, SLOT(slotMetaDataChanged())); @@ -146,18 +146,18 @@ void GETFileJob::slotMetaDataChanged() _etag = getEtagFromReply(reply()); if (!_directDownloadUrl.isEmpty() && !_etag.isEmpty()) { - qCDebug(lcGetFile) << "Direct download used, ignoring server ETag" << _etag; + qCInfo(lcGetJob) << "Direct download used, ignoring server ETag" << _etag; _etag = QByteArray(); // reset received ETag } else if (!_directDownloadUrl.isEmpty()) { // All fine, ETag empty and directDownloadUrl used } else if (_etag.isEmpty()) { - qCDebug(lcGetFile) << "No E-Tag reply by server, considering it invalid"; + qCWarning(lcGetJob) << "No E-Tag reply by server, considering it invalid"; _errorString = tr("No E-Tag received from server, check Proxy/Gateway"); _errorStatus = SyncFileItem::NormalError; reply()->abort(); return; } else if (!_expectedEtagForResume.isEmpty() && _expectedEtagForResume != _etag) { - qCDebug(lcGetFile) << "We received a different E-Tag for resuming!" + qCWarning(lcGetJob) << "We received a different E-Tag for resuming!" << _expectedEtagForResume << "vs" << _etag; _errorString = tr("We received a different E-Tag for resuming. Retrying next time."); _errorStatus = SyncFileItem::NormalError; @@ -174,7 +174,7 @@ void GETFileJob::slotMetaDataChanged() } } if (start != _resumeStart) { - qCDebug(lcGetFile) << "Wrong content-range: "<< ranges << " while expecting start was" << _resumeStart; + qCWarning(lcGetJob) << "Wrong content-range: "<< ranges << " while expecting start was" << _resumeStart; if (ranges.isEmpty()) { // device doesn't support range, just try again from scratch _device->close(); @@ -219,7 +219,7 @@ void GETFileJob::setBandwidthLimited(bool b) void GETFileJob::giveBandwidthQuota(qint64 q) { _bandwidthQuota = q; - qCDebug(lcGetFile) << "Got" << q << "bytes"; + qCDebug(lcGetJob) << "Got" << q << "bytes"; QMetaObject::invokeMethod(this, "slotReadyRead", Qt::QueuedConnection); } @@ -240,14 +240,14 @@ void GETFileJob::slotReadyRead() while(reply()->bytesAvailable() > 0) { if (_bandwidthChoked) { - qCDebug(lcGetFile) << "Download choked"; + qCWarning(lcGetJob) << "Download choked"; break; } qint64 toRead = bufferSize; if (_bandwidthLimited) { toRead = qMin(qint64(bufferSize), _bandwidthQuota); if (toRead == 0) { - qCDebug(lcGetFile) << "Out of quota"; + qCWarning(lcGetJob) << "Out of quota"; break; } _bandwidthQuota -= toRead; @@ -257,7 +257,7 @@ void GETFileJob::slotReadyRead() if (r < 0) { _errorString = networkReplyErrorString(*reply()); _errorStatus = SyncFileItem::NormalError; - qCDebug(lcGetFile) << "Error while reading from device: " << _errorString; + qCWarning(lcGetJob) << "Error while reading from device: " << _errorString; reply()->abort(); return; } @@ -267,7 +267,7 @@ void GETFileJob::slotReadyRead() if (w != r) { _errorString = _device->errorString(); _errorStatus = SyncFileItem::NormalError; - qCDebug(lcGetFile) << "Error while writing to file" << w << r << _errorString; + qCWarning(lcGetJob) << "Error while writing to file" << w << r << _errorString; reply()->abort(); return; } @@ -275,11 +275,16 @@ void GETFileJob::slotReadyRead() } if (reply()->isFinished() && reply()->bytesAvailable() == 0) { - qCDebug(lcGetFile) << "Actually finished!"; + qCDebug(lcGetJob) << "Actually finished!"; if (_bandwidthManager) { _bandwidthManager->unregisterDownloadJob(this); } if (!_hasEmittedFinishedSignal) { + qCInfo(lcGetJob) << "GET of" << reply()->request().url().toString() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()) + << reply()->rawHeader("Content-Range") << reply()->rawHeader("Content-Length"); + emit finishedSignal(); } _hasEmittedFinishedSignal = true; @@ -289,7 +294,7 @@ void GETFileJob::slotReadyRead() void GETFileJob::onTimedOut() { - qCDebug(lcGetFile) << "Timeout" << (reply() ? reply()->request().url() : path()); + qCWarning(lcGetJob) << "Timeout" << (reply() ? reply()->request().url() : path()); if (!reply()) return; _errorString = tr("Connection Timeout"); @@ -361,7 +366,7 @@ void PropagateDownloadFile::start() _resumeStart = _tmpFile.size(); if (_resumeStart > 0) { if (_resumeStart == _item->_size) { - qCDebug(lcPropagateDownload) << "File is already complete, no need to download"; + qCInfo(lcPropagateDownload) << "File is already complete, no need to download"; _tmpFile.close(); downloadFinished(); return; @@ -408,7 +413,7 @@ void PropagateDownloadFile::start() &_tmpFile, headers, expectedEtagForResume, _resumeStart, this); } else { // We were provided a direct URL, use that one - qCDebug(lcPropagateDownload) << "directDownloadUrl given for " << _item->_file << _item->_directDownloadUrl; + qCInfo(lcPropagateDownload) << "directDownloadUrl given for " << _item->_file << _item->_directDownloadUrl; if (!_item->_directDownloadCookies.isEmpty()) { headers["Cookie"] = _item->_directDownloadCookies.toUtf8(); @@ -447,13 +452,6 @@ void PropagateDownloadFile::slotGetFinished() GETFileJob *job = qobject_cast(sender()); ASSERT(job); - qCDebug(lcPropagateDownload) << job->reply()->request().url() << "FINISHED WITH STATUS" - << job->reply()->error() - << (job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : job->errorString()) - << _item->_httpErrorCode - << _tmpFile.size() << _item->_size << job->resumeStart() - << job->reply()->rawHeader("Content-Range") << job->reply()->rawHeader("Content-Length"); - QNetworkReply::NetworkError err = job->reply()->error(); if (err != QNetworkReply::NoError) { _item->_httpErrorCode = job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); @@ -462,14 +460,14 @@ void PropagateDownloadFile::slotGetFinished() // without the header. const bool badRangeHeader = job->resumeStart() > 0 && _item->_httpErrorCode == 416; if (badRangeHeader) { - qCDebug(lcPropagateDownload) << "server replied 416 to our range request, trying again without"; + qCWarning(lcPropagateDownload) << "server replied 416 to our range request, trying again without"; propagator()->_anotherSyncNeeded = true; } // Getting a 404 probably means that the file was deleted on the server. const bool fileNotFound = _item->_httpErrorCode == 404; if (fileNotFound) { - qCDebug(lcPropagateDownload) << "server replied 404, assuming file was deleted"; + qCWarning(lcPropagateDownload) << "server replied 404, assuming file was deleted"; } // Don't keep the temporary file if it is empty or we @@ -643,7 +641,7 @@ void handleRecallFile(const QString& filePath, const QString& folderPath, SyncJo QString recalledFile = QDir::cleanPath(baseDir.filePath(line)); if (!recalledFile.startsWith(folderPath) || !recalledFile.startsWith(baseDir.path())) { - qCDebug(lcPropagateDownload) << "Ignoring recall of " << recalledFile; + qCWarning(lcPropagateDownload) << "Ignoring recall of " << recalledFile; continue; } @@ -652,11 +650,11 @@ void handleRecallFile(const QString& filePath, const QString& folderPath, SyncJo SyncJournalFileRecord record = journal.getFileRecord(localRecalledFile); if (!record.isValid()) { - qCDebug(lcPropagateDownload) << "No db entry for recall of" << localRecalledFile; + qCWarning(lcPropagateDownload) << "No db entry for recall of" << localRecalledFile; continue; } - qCDebug(lcPropagateDownload) << "Recalling" << localRecalledFile << "Checksum:" << record._contentChecksumType << record._contentChecksum; + qCInfo(lcPropagateDownload) << "Recalling" << localRecalledFile << "Checksum:" << record._contentChecksumType << record._contentChecksum; QString targetPath = makeRecallFileName(recalledFile); @@ -739,7 +737,7 @@ void PropagateDownloadFile::downloadFinished() done(SyncFileItem::SoftError, renameError); return; } - qCDebug(lcPropagateDownload) << "Created conflict file" << fn << "->" << conflictFileName; + qCInfo(lcPropagateDownload) << "Created conflict file" << fn << "->" << conflictFileName; } FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime); @@ -781,7 +779,7 @@ void PropagateDownloadFile::downloadFinished() emit propagator()->touchedFile(fn); // The fileChanged() check is done above to generate better error messages. if (!FileSystem::uncheckedRenameReplace(_tmpFile.fileName(), fn, &error)) { - qCDebug(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(fn); + qCWarning(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(fn); // If we moved away the original file due to a conflict but can't // put the downloaded file in its place, we are in a bad spot: @@ -829,7 +827,7 @@ void PropagateDownloadFile::downloadFinished() qint64 duration = _stopwatch.elapsed(); if (isLikelyFinishedQuickly() && duration > 5*1000) { - qCDebug(lcPropagateDownload) << "WARNING: Unexpectedly slow connection, took" << duration << "msec for" << _item->_size - _resumeStart << "bytes for" << _item->_file; + qCWarning(lcPropagateDownload) << "WARNING: Unexpectedly slow connection, took" << duration << "msec for" << _item->_size - _resumeStart << "bytes for" << _item->_file; } } diff --git a/src/libsync/propagateremotedelete.cpp b/src/libsync/propagateremotedelete.cpp index c8bc87a24a..bc61e1c8d0 100644 --- a/src/libsync/propagateremotedelete.cpp +++ b/src/libsync/propagateremotedelete.cpp @@ -49,6 +49,10 @@ void DeleteJob::start() bool DeleteJob::finished() { + qCInfo(lcDeleteJob) << "DELETE of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + emit finishedSignal(); return true; } @@ -80,10 +84,6 @@ void PropagateRemoteDelete::slotDeleteJobFinished() ASSERT(_job); - qCDebug(lcPropagateRemoteDelete) << _job->reply()->request().url() << "FINISHED WITH STATUS" - << _job->reply()->error() - << (_job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : _job->errorString()); - QNetworkReply::NetworkError err = _job->reply()->error(); const int httpStatus = _job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); _item->_httpErrorCode = httpStatus; diff --git a/src/libsync/propagateremotemkdir.cpp b/src/libsync/propagateremotemkdir.cpp index a6db2c2d76..641f33124c 100644 --- a/src/libsync/propagateremotemkdir.cpp +++ b/src/libsync/propagateremotemkdir.cpp @@ -77,10 +77,6 @@ void PropagateRemoteMkdir::slotMkcolJobFinished() ASSERT(_job); - qCDebug(lcPropagateRemoteMkdir) << _job->reply()->request().url() << "FINISHED WITH STATUS" - << _job->reply()->error() - << (_job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : _job->errorString()); - QNetworkReply::NetworkError err = _job->reply()->error(); _item->_httpErrorCode = _job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); diff --git a/src/libsync/propagateremotemove.cpp b/src/libsync/propagateremotemove.cpp index a7d5b51625..c878b1cf74 100644 --- a/src/libsync/propagateremotemove.cpp +++ b/src/libsync/propagateremotemove.cpp @@ -25,6 +25,7 @@ namespace OCC { +Q_LOGGING_CATEGORY(lcMoveJob, "sync.networkjob.move", QtInfoMsg) Q_LOGGING_CATEGORY(lcPropagateRemoteMove, "sync.propagator.remotemove", QtInfoMsg) MoveJob::MoveJob(AccountPtr account, const QString& path, @@ -60,6 +61,10 @@ void MoveJob::start() bool MoveJob::finished() { + qCInfo(lcMoveJob) << "MOVE of" << reply()->request().url() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()); + emit finishedSignal(); return true; } @@ -120,10 +125,6 @@ void PropagateRemoteMove::slotMoveJobFinished() ASSERT(_job); - qCDebug(lcPropagateRemoteMove) << _job->reply()->request().url() << "FINISHED WITH STATUS" - << _job->reply()->error() - << (_job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : _job->errorString()); - QNetworkReply::NetworkError err = _job->reply()->error(); _item->_httpErrorCode = _job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); @@ -171,7 +172,7 @@ void PropagateRemoteMove::finalize() record._contentChecksum = oldRecord._contentChecksum; record._contentChecksumType = oldRecord._contentChecksumType; if (record._fileSize != oldRecord._fileSize) { - qCDebug(lcPropagateRemoteMove) << "Warning: file sizes differ on server vs sync journal: " << record._fileSize << oldRecord._fileSize; + qCWarning(lcPropagateRemoteMove) << "File sizes differ on server vs sync journal: " << record._fileSize << oldRecord._fileSize; record._fileSize = oldRecord._fileSize; // server might have claimed different size, we take the old one from the DB } } diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp index 2713d560c3..8988f9a3b3 100644 --- a/src/libsync/propagateupload.cpp +++ b/src/libsync/propagateupload.cpp @@ -43,8 +43,8 @@ const char owncloudShouldSoftCancelPropertyName[] = "owncloud-should-soft-cancel namespace OCC { -Q_LOGGING_CATEGORY(lcPutFile, "sync.networkjob.put", QtInfoMsg) -Q_LOGGING_CATEGORY(lcPoll, "sync.networkjob.poll", QtInfoMsg) +Q_LOGGING_CATEGORY(lcPutJob, "sync.networkjob.put", QtInfoMsg) +Q_LOGGING_CATEGORY(lcPollJob, "sync.networkjob.poll", QtInfoMsg) Q_LOGGING_CATEGORY(lcPropagateUpload, "sync.propagator.upload", QtInfoMsg) /** @@ -85,7 +85,7 @@ void PUTFileJob::start() { } if( reply()->error() != QNetworkReply::NoError ) { - qCWarning(lcPutFile) << " Network error: " << reply()->errorString(); + qCWarning(lcPutJob) << " Network error: " << reply()->errorString(); } connect(reply(), SIGNAL(uploadProgress(qint64,qint64)), this, SIGNAL(uploadProgress(qint64,qint64))); @@ -147,7 +147,7 @@ bool PollJob::finished() } QByteArray jsonData = reply()->readAll().trimmed(); - qCDebug(lcPoll) << ">" << jsonData << "<" << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + qCInfo(lcPollJob) << ">" << jsonData << "<" << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); QJsonParseError jsonParseError; QJsonObject status = QJsonDocument::fromJson(jsonData, &jsonParseError).object(); if (jsonParseError.error != QJsonParseError::NoError) { @@ -501,11 +501,11 @@ void PropagateUploadFileCommon::checkResettingErrors() auto uploadInfo = propagator()->_journal->getUploadInfo(_item->_file); uploadInfo._errorCount += 1; if (uploadInfo._errorCount > 3) { - qCDebug(lcPropagateUpload) << "Reset transfer of" << _item->_file + qCInfo(lcPropagateUpload) << "Reset transfer of" << _item->_file << "due to repeated error" << _item->_httpErrorCode; uploadInfo = SyncJournalDb::UploadInfo(); } else { - qCDebug(lcPropagateUpload) << "Error count for maybe-reset error" << _item->_httpErrorCode + qCInfo(lcPropagateUpload) << "Error count for maybe-reset error" << _item->_httpErrorCode << "on file" << _item->_file << "is" << uploadInfo._errorCount; } diff --git a/src/libsync/propagateupload.h b/src/libsync/propagateupload.h index a7a73dcbeb..913155f8d6 100644 --- a/src/libsync/propagateupload.h +++ b/src/libsync/propagateupload.h @@ -23,6 +23,7 @@ namespace OCC { +Q_DECLARE_LOGGING_CATEGORY(lcPutJob) Q_DECLARE_LOGGING_CATEGORY(lcPropagateUpload) class BandwidthManager; @@ -117,6 +118,12 @@ public: virtual void start() Q_DECL_OVERRIDE; virtual bool finished() Q_DECL_OVERRIDE { + qCInfo(lcPutJob) << "PUT of" << reply()->request().url().toString() << "FINISHED WITH STATUS" + << reply()->error() + << (reply()->error() == QNetworkReply::NoError ? QLatin1String("") : errorString()) + << reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) + << reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute); + emit finishedSignal(); return true; } diff --git a/src/libsync/propagateuploadng.cpp b/src/libsync/propagateuploadng.cpp index 61985f40c3..75635667d1 100644 --- a/src/libsync/propagateuploadng.cpp +++ b/src/libsync/propagateuploadng.cpp @@ -139,17 +139,17 @@ void PropagateUploadFileNG::slotPropfindFinished() if (_sent > _item->_size) { // Normally this can't happen because the size is xor'ed with the transfer id, and it is // therefore impossible that there is more data on the server than on the file. - qCWarning(lcPropagateUpload) << "Inconsistency while resuming " << _item->_file + qCCritical(lcPropagateUpload) << "Inconsistency while resuming " << _item->_file << ": the size on the server (" << _sent << ") is bigger than the size of the file (" << _item->_size << ")"; startNewUpload(); return; } - qCDebug(lcPropagateUpload) << "Resuming "<< _item->_file << " from chunk " << _currentChunk << "; sent ="<< _sent; + qCInfo(lcPropagateUpload) << "Resuming "<< _item->_file << " from chunk " << _currentChunk << "; sent ="<< _sent; if (!_serverChunks.isEmpty()) { - qCDebug(lcPropagateUpload) << "To Delete" << _serverChunks.keys(); + qCInfo(lcPropagateUpload) << "To Delete" << _serverChunks.keys(); propagator()->_activeJobList.append(this); _removeJobError = false; @@ -304,7 +304,7 @@ void PropagateUploadFileNG::startNextChunk() const QString fileName = propagator()->getFilePath(_item->_file); if (! device->prepareAndOpen(fileName, _sent, _currentChunkSize)) { - qCDebug(lcPropagateUpload) << "ERR: Could not prepare upload device: " << device->errorString(); + qCWarning(lcPropagateUpload) << "Could not prepare upload device: " << device->errorString(); // If the file is currently locked, we want to retry the sync // when it becomes available again. @@ -346,12 +346,6 @@ void PropagateUploadFileNG::slotPutFinished() slotJobDestroyed(job); // remove it from the _jobs list - qCDebug(lcPropagateUpload) << job->reply()->request().url() << "FINISHED WITH STATUS" - << job->reply()->error() - << (job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : job->errorString()) - << job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) - << job->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute); - propagator()->_activeJobList.removeOne(this); if (_finished) { @@ -365,7 +359,7 @@ void PropagateUploadFileNG::slotPutFinished() if (err == QNetworkReply::OperationCanceledError && job->reply()->property("owncloud-should-soft-cancel").isValid()) { // Abort the job and try again later. // This works around a bug in QNAM wich might reuse a non-empty buffer for the next request. - qCDebug(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2."; + qCWarning(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2."; propagator()->_anotherSyncNeeded = true; abortWithError(SyncFileItem::SoftError, tr("Forcing job abort on HTTP connection reset with Qt < 5.4.2.")); return; @@ -413,7 +407,7 @@ void PropagateUploadFileNG::slotPutFinished() targetSize, propagator()->syncOptions()._maxChunkSize); - qCDebug(lcPropagateUpload) << "Chunked upload of" << _currentChunkSize << "bytes took" << uploadTime + qCInfo(lcPropagateUpload) << "Chunked upload of" << _currentChunkSize << "bytes took" << uploadTime << "ms, desired is" << targetDuration << "ms, expected good chunk size is" << predictedGoodSize << "bytes and nudged next chunk size to " << propagator()->_chunkSize << "bytes"; @@ -496,7 +490,7 @@ void PropagateUploadFileNG::slotMoveJobFinished() } else { // the old file id should only be empty for new files uploaded if( !_item->_fileId.isEmpty() && _item->_fileId != fid ) { - qCDebug(lcPropagateUpload) << "WARN: File ID changed!" << _item->_fileId << fid; + qCWarning(lcPropagateUpload) << "File ID changed!" << _item->_fileId << fid; } _item->_fileId = fid; } diff --git a/src/libsync/propagateuploadv1.cpp b/src/libsync/propagateuploadv1.cpp index 1e90d297d8..6a266f3acf 100644 --- a/src/libsync/propagateuploadv1.cpp +++ b/src/libsync/propagateuploadv1.cpp @@ -83,7 +83,7 @@ void PropagateUploadFileV1::startNextChunk() int sendingChunk = (_currentChunk + _startChunk) % _chunkCount; // XOR with chunk size to make sure everything goes well if chunk size changes between runs uint transid = _transferId ^ chunkSize(); - qCDebug(lcPropagateUpload) << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid; + qCInfo(lcPropagateUpload) << "Upload chunk" << sendingChunk << "of" << _chunkCount << "transferid(remote)=" << transid; path += QString("-chunking-%1-%2-%3").arg(transid).arg(_chunkCount).arg(sendingChunk); headers["OC-Chunked"] = "1"; @@ -110,7 +110,7 @@ void PropagateUploadFileV1::startNextChunk() const QString fileName = propagator()->getFilePath(_item->_file); if (! device->prepareAndOpen(fileName, chunkStart, currentChunkSize)) { - qCDebug(lcPropagateUpload) << "ERR: Could not prepare upload device: " << device->errorString(); + qCWarning(lcPropagateUpload) << "Could not prepare upload device: " << device->errorString(); // If the file is currently locked, we want to retry the sync // when it becomes available again. @@ -176,12 +176,6 @@ void PropagateUploadFileV1::slotPutFinished() slotJobDestroyed(job); // remove it from the _jobs list - qCDebug(lcPropagateUpload) << job->reply()->request().url() << "FINISHED WITH STATUS" - << job->reply()->error() - << (job->reply()->error() == QNetworkReply::NoError ? QLatin1String("") : job->errorString()) - << job->reply()->attribute(QNetworkRequest::HttpStatusCodeAttribute) - << job->reply()->attribute(QNetworkRequest::HttpReasonPhraseAttribute); - propagator()->_activeJobList.removeOne(this); if (_finished) { @@ -194,7 +188,7 @@ void PropagateUploadFileV1::slotPutFinished() #if QT_VERSION < QT_VERSION_CHECK(5, 4, 2) if (err == QNetworkReply::OperationCanceledError && job->reply()->property("owncloud-should-soft-cancel").isValid()) { // Abort the job and try again later. // This works around a bug in QNAM wich might reuse a non-empty buffer for the next request. - qCDebug(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2."; + qCWarning(lcPropagateUpload) << "Forcing job abort on HTTP connection reset with Qt < 5.4.2."; propagator()->_anotherSyncNeeded = true; abortWithError(SyncFileItem::SoftError, tr("Forcing job abort on HTTP connection reset with Qt < 5.4.2.")); return; @@ -320,7 +314,7 @@ void PropagateUploadFileV1::slotPutFinished() QByteArray fid = job->reply()->rawHeader("OC-FileID"); if( !fid.isEmpty() ) { if( !_item->_fileId.isEmpty() && _item->_fileId != fid ) { - qCDebug(lcPropagateUpload) << "WARN: File ID changed!" << _item->_fileId << fid; + qCWarning(lcPropagateUpload) << "File ID changed!" << _item->_fileId << fid; } _item->_fileId = fid; } diff --git a/src/libsync/propagatorjobs.cpp b/src/libsync/propagatorjobs.cpp index 4cc8f5ec54..94bab37b12 100644 --- a/src/libsync/propagatorjobs.cpp +++ b/src/libsync/propagatorjobs.cpp @@ -74,7 +74,7 @@ bool PropagateLocalRemove::removeRecursively(const QString& path) if (!ok) { _error += PropagateLocalRemove::tr("Error removing '%1': %2;"). arg(QDir::toNativeSeparators(di.filePath()), removeError) + " "; - qCDebug(lcPropagateLocalRemove) << "Error removing " << di.filePath() << ':' << removeError; + qCWarning(lcPropagateLocalRemove) << "Error removing " << di.filePath() << ':' << removeError; } } if (success && !ok) { @@ -100,7 +100,7 @@ bool PropagateLocalRemove::removeRecursively(const QString& path) if (!success) { _error += PropagateLocalRemove::tr("Could not remove folder '%1'") .arg(QDir::toNativeSeparators(absolute)) + " "; - qCDebug(lcPropagateLocalRemove) << "Error removing folder" << absolute; + qCWarning(lcPropagateLocalRemove) << "Error removing folder" << absolute; } } return success; diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index 9c6935ec08..9c197c8eb7 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -50,8 +50,6 @@ #include #include -extern "C" const char *csync_instruction_str(enum csync_instructions_e instr); - namespace OCC { Q_LOGGING_CATEGORY(lcEngine, "sync.engine") @@ -217,7 +215,7 @@ QString SyncEngine::csyncErrorToString(CSYNC_STATUS err) bool SyncEngine::checkErrorBlacklisting( SyncFileItem &item ) { if( !_journal ) { - qCWarning(lcEngine) << "Journal is undefined!"; + qCCritical(lcEngine) << "Journal is undefined!"; return false; } @@ -233,7 +231,7 @@ bool SyncEngine::checkErrorBlacklisting( SyncFileItem &item ) // If duration has expired, it's not blacklisted anymore time_t now = Utility::qDateTimeToTime_t(QDateTime::currentDateTime()); if( now >= entry._lastTryTime + entry._ignoreDuration ) { - qCDebug(lcEngine) << "blacklist entry for " << item._file << " has expired!"; + qCInfo(lcEngine) << "blacklist entry for " << item._file << " has expired!"; return false; } @@ -243,24 +241,24 @@ bool SyncEngine::checkErrorBlacklisting( SyncFileItem &item ) if(item._modtime == 0 || entry._lastTryModtime == 0) { return false; } else if( item._modtime != entry._lastTryModtime ) { - qCDebug(lcEngine) << item._file << " is blacklisted, but has changed mtime!"; + qCInfo(lcEngine) << item._file << " is blacklisted, but has changed mtime!"; return false; } else if( item._renameTarget != entry._renameTarget) { - qCDebug(lcEngine) << item._file << " is blacklisted, but rename target changed from" << entry._renameTarget; + qCInfo(lcEngine) << item._file << " is blacklisted, but rename target changed from" << entry._renameTarget; return false; } } else if( item._direction == SyncFileItem::Down ) { // download, check the etag. if( item._etag.isEmpty() || entry._lastTryEtag.isEmpty() ) { - qCDebug(lcEngine) << item._file << "one ETag is empty, no blacklisting"; + qCInfo(lcEngine) << item._file << "one ETag is empty, no blacklisting"; return false; } else if( item._etag != entry._lastTryEtag ) { - qCDebug(lcEngine) << item._file << " is blacklisted, but has changed etag!"; + qCInfo(lcEngine) << item._file << " is blacklisted, but has changed etag!"; return false; } } - qCDebug(lcEngine) << "Item is on blacklist: " << entry._file + qCInfo(lcEngine) << "Item is on blacklist: " << entry._file << "retries:" << entry._retryCount << "for another" << (entry._lastTryTime + entry._ignoreDuration - now) << "s"; item._instruction = CSYNC_INSTRUCTION_ERROR; @@ -287,7 +285,7 @@ void SyncEngine::deleteStaleDownloadInfos(const SyncFileItemVector &syncItems) _journal->getAndDeleteStaleDownloadInfos(download_file_paths); foreach (const SyncJournalDb::DownloadInfo & deleted_info, deleted_infos) { const QString tmppath = _propagator->getFilePath(deleted_info._tmpfile); - qCDebug(lcEngine) << "Deleting stale temporary file: " << tmppath; + qCInfo(lcEngine) << "Deleting stale temporary file: " << tmppath; FileSystem::remove(tmppath); } } @@ -631,7 +629,7 @@ int SyncEngine::treewalkFile( TREE_WALK_FILE *file, bool remote ) // issues or DST changes. (We simply ignore files that goes in the past less than // two hours for the backup detection heuristics.) _backInTimeFiles++; - qCDebug(lcEngine) << file->path << "has a timestamp earlier than the local file"; + qCWarning(lcEngine) << file->path << "has a timestamp earlier than the local file"; } else if (difftime > 0) { _hasForwardInTimeFiles = true; } @@ -689,10 +687,10 @@ void SyncEngine::handleSyncError(CSYNC *ctx, const char *state) { if( errStr.contains("ownclouds://") ) errStr.replace("ownclouds://", "https://"); if( errStr.contains("owncloud://") ) errStr.replace("owncloud://", "http://"); - qCDebug(lcEngine) << " #### ERROR during "<< state << ": " << errStr; + qCWarning(lcEngine) << "ERROR during "<< state << ": " << errStr; if( CSYNC_STATUS_IS_EQUAL( err, CSYNC_STATUS_ABORTED) ) { - qCDebug(lcEngine) << "Update phase was aborted by user!"; + qCInfo(lcEngine) << "Update phase was aborted by user!"; } else if( CSYNC_STATUS_IS_EQUAL( err, CSYNC_STATUS_SERVICE_UNAVAILABLE ) || CSYNC_STATUS_IS_EQUAL( err, CSYNC_STATUS_CONNECT_ERROR )) { emit csyncUnavailable(); @@ -707,7 +705,7 @@ void SyncEngine::startSync() if (_journal->exists()) { QVector< SyncJournalDb::PollInfo > pollInfos = _journal->getPollInfos(); if (!pollInfos.isEmpty()) { - qCDebug(lcEngine) << "Finish Poll jobs before starting a sync"; + qCInfo(lcEngine) << "Finish Poll jobs before starting a sync"; CleanupPollsJob *job = new CleanupPollsJob(pollInfos, _account, _journal, _localPath, this); connect(job, SIGNAL(finished()), this, SLOT(startSync())); @@ -741,7 +739,7 @@ void SyncEngine::startSync() const qint64 minFree = criticalFreeSpaceLimit(); const qint64 freeBytes = Utility::freeDiskSpace(_localPath); if (freeBytes >= 0) { - qCDebug(lcEngine) << "There are" << freeBytes << "bytes available at" << _localPath + qCInfo(lcEngine) << "There are" << freeBytes << "bytes available at" << _localPath << "and at least" << minFree << "are required"; if (freeBytes < minFree) { _anotherSyncNeeded = DelayedFollowUp; @@ -753,7 +751,7 @@ void SyncEngine::startSync() return; } } else { - qCDebug(lcEngine) << "Could not determine free space available at" << _localPath; + qCWarning(lcEngine) << "Could not determine free space available at" << _localPath; } _syncItemMap.clear(); @@ -763,9 +761,9 @@ void SyncEngine::startSync() int fileRecordCount = -1; if (!_journal->exists()) { - qCDebug(lcEngine) << "New sync (no sync journal exists)"; + qCInfo(lcEngine) << "New sync (no sync journal exists)"; } else { - qCDebug(lcEngine) << "Sync with existing sync journal"; + qCInfo(lcEngine) << "Sync with existing sync journal"; } QString verStr("Using Qt "); @@ -775,12 +773,12 @@ void SyncEngine::startSync() verStr.append( " SSL library " ).append(QSslSocket::sslLibraryVersionString().toUtf8().data()); #endif verStr.append( " on ").append(Utility::platformName()); - qCDebug(lcEngine) << verStr; + qCInfo(lcEngine) << verStr; fileRecordCount = _journal->getFileRecordCount(); // this creates the DB if it does not exist yet if( fileRecordCount == -1 ) { - qCDebug(lcEngine) << "No way to create a sync journal!"; + qCWarning(lcEngine) << "No way to create a sync journal!"; emit csyncError(tr("Unable to open or create the local sync database. Make sure you have write access in the sync folder.")); finalize(false); return; @@ -797,9 +795,9 @@ void SyncEngine::startSync() auto selectiveSyncBlackList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok); if (ok) { bool usingSelectiveSync = (!selectiveSyncBlackList.isEmpty()); - qCDebug(lcEngine) << (usingSelectiveSync ? "Using Selective Sync" : "NOT Using Selective Sync"); + qCInfo(lcEngine) << (usingSelectiveSync ? "Using Selective Sync" : "NOT Using Selective Sync"); } else { - qCDebug(lcEngine) << "Could not retrieve selective sync list from DB"; + qCWarning(lcEngine) << "Could not retrieve selective sync list from DB"; emit csyncError(tr("Unable to read the blacklist from the local database")); finalize(false); return; @@ -812,7 +810,7 @@ void SyncEngine::startSync() _stopWatch.start(); - qCDebug(lcEngine) << "#### Discovery start #################################################### >>"; + qCInfo(lcEngine) << "#### Discovery start ####################################################"; // Usually the discovery runs in the background: We want to avoid // stealing too much time from other processes that the user might @@ -822,7 +820,7 @@ void SyncEngine::startSync() _discoveryMainThread = new DiscoveryMainThread(account()); _discoveryMainThread->setParent(this); connect(this, SIGNAL(finished(bool)), _discoveryMainThread, SLOT(deleteLater())); - qCDebug(lcEngine) << "=====Server" << account()->serverVersion() + qCInfo(lcEngine) << "Server" << account()->serverVersion() << QString("rootEtagChangesNotOnlySubFolderEtags=%1").arg(account()->rootEtagChangesNotOnlySubFolderEtags()); if (account()->rootEtagChangesNotOnlySubFolderEtags()) { connect(_discoveryMainThread, SIGNAL(etag(QString)), this, SLOT(slotRootEtagReceived(QString))); @@ -836,7 +834,7 @@ void SyncEngine::startSync() _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncWhiteList, &ok); if (!ok) { delete discoveryJob; - qCDebug(lcEngine) << "Unable to read selective sync list, aborting."; + qCWarning(lcEngine) << "Unable to read selective sync list, aborting."; emit csyncError(tr("Unable to read from the sync journal.")); finalize(false); return; @@ -862,7 +860,7 @@ void SyncEngine::startSync() void SyncEngine::slotRootEtagReceived(const QString &e) { if (_remoteRootEtag.isEmpty()) { - qCDebug(lcEngine) << e; + qCDebug(lcEngine) << "Root etag:" << e; _remoteRootEtag = e; emit rootEtag(_remoteRootEtag); } @@ -877,11 +875,11 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) handleSyncError(_csync_ctx, "csync_update"); return; } - qCDebug(lcEngine) << "<<#### Discovery end #################################################### " << _stopWatch.addLapTime(QLatin1String("Discovery Finished")); + qCInfo(lcEngine) << "#### Discovery end #################################################### " << _stopWatch.addLapTime(QLatin1String("Discovery Finished")) << "ms"; // Sanity check if (!_journal->isConnected()) { - qCDebug(lcEngine) << "Bailing out, DB failure"; + qCWarning(lcEngine) << "Bailing out, DB failure"; emit csyncError(tr("Cannot open the sync journal")); finalize(false); return; @@ -895,7 +893,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) return; } - qCDebug(lcEngine) << "<<#### Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Reconcile Finished")); + qCInfo(lcEngine) << "#### Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Reconcile Finished")) << "ms"; _hasNoneFiles = false; _hasRemoveFile = false; @@ -909,16 +907,16 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) _renamedFolders.clear(); if( csync_walk_local_tree(_csync_ctx, &treewalkLocal, 0) < 0 ) { - qCDebug(lcEngine) << "Error in local treewalk."; + qCWarning(lcEngine) << "Error in local treewalk."; walkOk = false; } if( walkOk && csync_walk_remote_tree(_csync_ctx, &treewalkRemote, 0) < 0 ) { - qCDebug(lcEngine) << "Error in remote treewalk."; + qCWarning(lcEngine) << "Error in remote treewalk."; } if (_csync_ctx->remote.root_perms) { _remotePerms[QLatin1String("")] = _csync_ctx->remote.root_perms; - qCDebug(lcEngine) << "Permissions of the root folder: " << _remotePerms[QLatin1String("")]; + qCInfo(lcEngine) << "Permissions of the root folder: " << _remotePerms[QLatin1String("")]; } // Re-init the csync context to free memory @@ -948,11 +946,11 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) } if (!_hasNoneFiles && _hasRemoveFile) { - qCDebug(lcEngine) << "All the files are going to be changed, asking the user"; + qCInfo(lcEngine) << "All the files are going to be changed, asking the user"; bool cancel = false; emit aboutToRemoveAllFiles(syncItems.first()->_direction, &cancel); if (cancel) { - qCDebug(lcEngine) << "Abort sync"; + qCInfo(lcEngine) << "User aborted sync"; finalize(false); return; } @@ -964,14 +962,14 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) // Note that an empty ("") fingerprint is valid and means it was empty on the server before. if (!databaseFingerprint.isNull() && _discoveryMainThread->_dataFingerprint != databaseFingerprint) { - qCDebug(lcEngine) << "data fingerprint changed, assume restore from backup" << databaseFingerprint << _discoveryMainThread->_dataFingerprint; + qCInfo(lcEngine) << "data fingerprint changed, assume restore from backup" << databaseFingerprint << _discoveryMainThread->_dataFingerprint; restoreOldFiles(syncItems); } else if (!_hasForwardInTimeFiles && _backInTimeFiles >= 2 && _account->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) { // The server before ownCloud 9.1 did not have the data-fingerprint property. So in that // case we use heuristics to detect restored backup. This is disabled with newer version // because this causes troubles to the user and is not as reliable as the data-fingerprint. - qCDebug(lcEngine) << "All the changes are bringing files in the past, asking the user"; + qCInfo(lcEngine) << "All the changes are bringing files in the past, asking the user"; // this typically happen when a backup is restored on the server bool restore = false; emit aboutToRestoreBackup(&restore); @@ -997,7 +995,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) #ifndef NDEBUG QString script = qgetenv("OWNCLOUD_POST_UPDATE_SCRIPT"); - qCDebug(lcEngine) << "OOO => Post Update Script: " << script; + qCDebug(lcEngine) << "Post Update Script: " << script; QProcess::execute(script.toUtf8()); #else qCWarning(lcEngine) << "**** Attention: POST_UPDATE_SCRIPT installed, but not executed because compiled with NDEBUG"; @@ -1032,7 +1030,7 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) _propagator->start(syncItems); - qCDebug(lcEngine) << "<<#### Post-Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Post-Reconcile Finished")); + qCInfo(lcEngine) << "#### Post-Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Post-Reconcile Finished")) << "ms"; } void SyncEngine::slotCleanPollsJobAborted(const QString &error) @@ -1063,15 +1061,12 @@ void SyncEngine::setNetworkLimits(int upload, int download) ; if( propDownloadLimit != 0 || propUploadLimit != 0 ) { - qCDebug(lcEngine) << " N------N Network Limits (down/up) " << propDownloadLimit << propUploadLimit; + qCInfo(lcEngine) << "Network Limits (down/up) " << propDownloadLimit << propUploadLimit; } } void SyncEngine::slotItemCompleted(const SyncFileItemPtr &item) { - const char * instruction_str = csync_instruction_str(item->_instruction); - qCDebug(lcEngine) << item->_file << instruction_str << item->_status << item->_errorString; - _progressInfo->setProgressComplete(*item); if (item->_status == SyncFileItem::FatalError) { @@ -1116,7 +1111,7 @@ void SyncEngine::finalize(bool success) csync_commit(_csync_ctx); _journal->close(); - qCDebug(lcEngine) << "CSync run took " << _stopWatch.addLapTime(QLatin1String("Sync Finished")); + qCInfo(lcEngine) << "CSync run took " << _stopWatch.addLapTime(QLatin1String("Sync Finished")) << "ms"; _stopWatch.stop(); s_anySyncRunning = false; @@ -1201,7 +1196,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) // No permissions set break; } else if ((*it)->_isDirectory && !perms.contains("K")) { - qCDebug(lcEngine) << "checkForPermission: ERROR" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: ERROR" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_ERROR; (*it)->_status = SyncFileItem::NormalError; (*it)->_errorString = tr("Not allowed because you don't have permission to add subfolders to that folder"); @@ -1215,7 +1210,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) // but delete and upload. It will then be restored if needed. _journal->avoidRenamesOnNextSync((*it)->_file); _anotherSyncNeeded = ImmediateFollowUp; - qCDebug(lcEngine) << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder"; + qCWarning(lcEngine) << "Moving of " << (*it)->_file << " canceled because no permission to add parent folder"; } (*it)->_instruction = CSYNC_INSTRUCTION_ERROR; (*it)->_status = SyncFileItem::SoftError; @@ -1223,7 +1218,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) } } else if (!(*it)->_isDirectory && !perms.contains("C")) { - qCDebug(lcEngine) << "checkForPermission: ERROR" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: ERROR" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_ERROR; (*it)->_status = SyncFileItem::NormalError; (*it)->_errorString = tr("Not allowed because you don't have permission to add files in that folder"); @@ -1236,7 +1231,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) // No permissions set break; } if (!perms.contains("W")) { - qCDebug(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_CONFLICT; (*it)->_direction = SyncFileItem::Down; (*it)->_isRestoration = true; @@ -1257,7 +1252,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) break; } if (!perms.contains("D")) { - qCDebug(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_NEW; (*it)->_direction = SyncFileItem::Down; (*it)->_isRestoration = true; @@ -1275,7 +1270,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) continue; } - qCDebug(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_NEW; (*it)->_direction = SyncFileItem::Down; @@ -1351,7 +1346,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) (*it)->_direction = SyncFileItem::Down; (*it)->_errorString = tr("Move not allowed, item restored"); (*it)->_isRestoration = true; - qCDebug(lcEngine) << "checkForPermission: MOVING BACK" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: MOVING BACK" << (*it)->_file; // in case something does wrong, we will not do it next time _journal->avoidRenamesOnNextSync((*it)->_file); } else @@ -1364,7 +1359,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) sourceOK ? tr("the destination") : tr("the source")); (*it)->_errorString = errorString; - qCDebug(lcEngine) << "checkForPermission: ERROR MOVING" << (*it)->_file << errorString; + qCWarning(lcEngine) << "checkForPermission: ERROR MOVING" << (*it)->_file << errorString; // Avoid a rename on next sync: // TODO: do the resolution now already so we don't need two sync @@ -1381,7 +1376,7 @@ void SyncEngine::checkForPermission(SyncFileItemVector &syncItems) (*it)->_instruction = CSYNC_INSTRUCTION_ERROR; (*it)->_status = SyncFileItem::NormalError; (*it)->_errorString = errorString; - qCDebug(lcEngine) << "checkForPermission: ERROR MOVING" << (*it)->_file; + qCWarning(lcEngine) << "checkForPermission: ERROR MOVING" << (*it)->_file; } } } @@ -1419,11 +1414,11 @@ void SyncEngine::restoreOldFiles(SyncFileItemVector &syncItems) switch ((*it)->_instruction) { case CSYNC_INSTRUCTION_SYNC: - qCDebug(lcEngine) << "restoreOldFiles: RESTORING" << (*it)->_file; + qCWarning(lcEngine) << "restoreOldFiles: RESTORING" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_CONFLICT; break; case CSYNC_INSTRUCTION_REMOVE: - qCDebug(lcEngine) << "restoreOldFiles: RESTORING" << (*it)->_file; + qCWarning(lcEngine) << "restoreOldFiles: RESTORING" << (*it)->_file; (*it)->_instruction = CSYNC_INSTRUCTION_NEW; (*it)->_direction = SyncFileItem::Up; break; diff --git a/src/libsync/syncjournaldb.cpp b/src/libsync/syncjournaldb.cpp index 5fc201c89e..5f3f2ed621 100644 --- a/src/libsync/syncjournaldb.cpp +++ b/src/libsync/syncjournaldb.cpp @@ -82,43 +82,43 @@ bool SyncJournalDb::maybeMigrateDb(const QString& localPath, const QString& abso if( FileSystem::fileExists( newDbName ) ) { if( !FileSystem::remove(newDbName, &error) ) { - qCDebug(lcDb) << "Database migration: Could not remove db file" << newDbName + qCWarning(lcDb) << "Database migration: Could not remove db file" << newDbName << "due to" << error; return false; } } if( FileSystem::fileExists( newDbNameWal ) ) { if( !FileSystem::remove(newDbNameWal, &error) ) { - qCDebug(lcDb) << "Database migration: Could not remove db WAL file" << newDbNameWal + qCWarning(lcDb) << "Database migration: Could not remove db WAL file" << newDbNameWal << "due to" << error; return false; } } if( FileSystem::fileExists( newDbNameShm ) ) { if( !FileSystem::remove(newDbNameShm, &error) ) { - qCDebug(lcDb) << "Database migration: Could not remove db SHM file" << newDbNameShm + qCWarning(lcDb) << "Database migration: Could not remove db SHM file" << newDbNameShm << "due to" << error; return false; } } if( !FileSystem::rename(oldDbName, newDbName, &error) ) { - qCDebug(lcDb) << "Database migration: could not rename " << oldDbName + qCWarning(lcDb) << "Database migration: could not rename " << oldDbName << "to" << newDbName << ":" << error; return false; } if( !FileSystem::rename(oldDbNameWal, newDbNameWal, &error) ) { - qCDebug(lcDb) << "Database migration: could not rename " << oldDbNameWal + qCWarning(lcDb) << "Database migration: could not rename " << oldDbNameWal << "to" << newDbNameWal << ":" << error; return false; } if( !FileSystem::rename(oldDbNameShm, newDbNameShm, &error) ) { - qCDebug(lcDb) << "Database migration: could not rename " << oldDbNameShm + qCWarning(lcDb) << "Database migration: could not rename " << oldDbNameShm << "to" << newDbNameShm << ":" << error; return false; } - qCDebug(lcDb) << "Journal successfully migrated from" << oldDbName << "to" << newDbName; + qCInfo(lcDb) << "Journal successfully migrated from" << oldDbName << "to" << newDbName; return true; } @@ -142,9 +142,7 @@ void SyncJournalDb::walCheckpoint() t.start(); SqlQuery pragma1(_db); pragma1.prepare("PRAGMA wal_checkpoint(FULL);"); - if (!pragma1.exec()) { - qCDebug(lcDb) << pragma1.error(); - } else { + if (pragma1.exec()) { qCDebug(lcDb) << "took" << t.elapsed() << "msec"; } } @@ -153,11 +151,10 @@ void SyncJournalDb::startTransaction() { if( _transaction == 0 ) { if( !_db.transaction() ) { - qCDebug(lcDb) << "ERROR starting transaction: " << _db.error(); + qCWarning(lcDb) << "ERROR starting transaction: " << _db.error(); return; } _transaction = 1; - // qCDebug(lcDb) << "XXX Transaction start!"; } else { qCDebug(lcDb) << "Database Transaction is running, not starting another one!"; } @@ -167,11 +164,10 @@ void SyncJournalDb::commitTransaction() { if( _transaction == 1 ) { if( ! _db.commit() ) { - qCDebug(lcDb) << "ERROR committing to the database: " << _db.error(); + qCWarning(lcDb) << "ERROR committing to the database: " << _db.error(); return; } _transaction = 0; - // qCDebug(lcDb) << "XXX Transaction END!"; } else { qCDebug(lcDb) << "No database Transaction to commit"; } @@ -192,9 +188,9 @@ static QString defaultJournalMode(const QString & dbPath) // See #2693: Some exFAT file systems seem unable to cope with the // WAL journaling mode. They work fine with DELETE. QString fileSystem = FileSystem::fileSystemForPath(dbPath); - qCDebug(lcDb) << "Detected filesystem" << fileSystem << "for" << dbPath; + qCInfo(lcDb) << "Detected filesystem" << fileSystem << "for" << dbPath; if (fileSystem.contains("FAT")) { - qCDebug(lcDb) << "Filesystem contains FAT - using DELETE journal mode"; + qCInfo(lcDb) << "Filesystem contains FAT - using DELETE journal mode"; return "DELETE"; } #else @@ -210,19 +206,19 @@ bool SyncJournalDb::checkConnect() } if( _dbFile.isEmpty()) { - qCDebug(lcDb) << "Database filename" + _dbFile + " is empty"; + qCWarning(lcDb) << "Database filename" + _dbFile + " is empty"; return false; } // The database file is created by this call (SQLITE_OPEN_CREATE) if( !_db.openOrCreateReadWrite(_dbFile) ) { QString error = _db.error(); - qCDebug(lcDb) << "Error opening the db: " << error; + qCWarning(lcDb) << "Error opening the db: " << error; return false; } if( !QFile::exists(_dbFile) ) { - qCDebug(lcDb) << "Database file" + _dbFile + " does not exist"; + qCWarning(lcDb) << "Database file" + _dbFile + " does not exist"; return false; } @@ -232,7 +228,7 @@ bool SyncJournalDb::checkConnect() return sqlFail("SELECT sqlite_version()", pragma1); } else { pragma1.next(); - qCDebug(lcDb) << "sqlite3 version" << pragma1.stringValue(0); + qCInfo(lcDb) << "sqlite3 version" << pragma1.stringValue(0); } // Allow forcing the journal mode for debugging @@ -246,7 +242,7 @@ bool SyncJournalDb::checkConnect() return sqlFail("Set PRAGMA journal_mode", pragma1); } else { pragma1.next(); - qCDebug(lcDb) << "sqlite3 journal_mode=" << pragma1.stringValue(0); + qCInfo(lcDb) << "sqlite3 journal_mode=" << pragma1.stringValue(0); } // For debugging purposes, allow temp_store to be set @@ -256,7 +252,7 @@ bool SyncJournalDb::checkConnect() if (!pragma1.exec()) { return sqlFail("Set PRAGMA temp_store", pragma1); } - qCDebug(lcDb) << "sqlite3 with temp_store =" << env_temp_store; + qCInfo(lcDb) << "sqlite3 with temp_store =" << env_temp_store; } pragma1.prepare("PRAGMA synchronous = 1;"); @@ -387,7 +383,7 @@ bool SyncJournalDb::checkConnect() SqlQuery versionQuery("SELECT major, minor, patch FROM version;", _db); if (!versionQuery.next()) { // If there was no entry in the table, it means we are likely upgrading from 1.5 - qCDebug(lcDb) << "possibleUpgradeFromMirall_1_5 detected!"; + qCInfo(lcDb) << "possibleUpgradeFromMirall_1_5 detected!"; forceRemoteDiscovery = true; createQuery.prepare("INSERT INTO version VALUES (?1, ?2, ?3, ?4);"); @@ -405,7 +401,7 @@ bool SyncJournalDb::checkConnect() int patch = versionQuery.intValue(2); if( major == 1 && minor == 8 && (patch == 0 || patch == 1) ) { - qCDebug(lcDb) << "possibleUpgradeFromMirall_1_8_0_or_1 detected!"; + qCInfo(lcDb) << "possibleUpgradeFromMirall_1_8_0_or_1 detected!"; forceRemoteDiscovery = true; } @@ -413,7 +409,7 @@ bool SyncJournalDb::checkConnect() // local files and a remote discovery will fix them. // See #5190 #5242. if( major == 2 && minor < 3) { - qCDebug(lcDb) << "upgrade form client < 2.3.0 detected! forcing remote discovery"; + qCInfo(lcDb) << "upgrade form client < 2.3.0 detected! forcing remote discovery"; forceRemoteDiscovery = true; } @@ -439,7 +435,7 @@ bool SyncJournalDb::checkConnect() bool rc = updateDatabaseStructure(); if( !rc ) { - qCDebug(lcDb) << "WARN: Failed to update the database structure!"; + qCWarning(lcDb) << "Failed to update the database structure!"; } /* @@ -602,7 +598,7 @@ bool SyncJournalDb::checkConnect() void SyncJournalDb::close() { QMutexLocker locker(&_mutex); - qCDebug(lcDb) << "Closing DB" << _dbFile; + qCInfo(lcDb) << "Closing DB" << _dbFile; commitTransaction(); @@ -798,8 +794,6 @@ QStringList SyncJournalDb::tableColumns( const QString& table ) query.prepare(q); if(!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err;; return columns; } @@ -838,13 +832,18 @@ bool SyncJournalDb::setFileRecord( const SyncJournalFileRecord& _record ) QString prefix = record._path + "/"; foreach(const QString &it, _avoidReadFromDbOnNextSyncFilter) { if (it.startsWith(prefix)) { - qCDebug(lcDb) << "Filtered writing the etag of" << prefix << "because it is a prefix of" << it; + qCInfo(lcDb) << "Filtered writing the etag of" << prefix << "because it is a prefix of" << it; record._etag = "_invalid_"; break; } } } + qCInfo(lcDb) << "Updating file record for path:" << record._path << "inode:" << record._inode + << "modtime:" << record._modtime << "type:" << record._type + << "etag:" << record._etag << "fileId:" << record._fileId << "remotePerm:" << record._remotePerm + << "fileSize:" << record._fileSize << "checksum:" << record._contentChecksum << record._contentChecksumType; + qlonglong phash = getPHash(record._path); if( checkConnect() ) { QByteArray arr = record._path.toUtf8(); @@ -876,20 +875,13 @@ bool SyncJournalDb::setFileRecord( const SyncJournalFileRecord& _record ) _setFileRecordQuery->bindValue(16, contentChecksumTypeId ); if( !_setFileRecordQuery->exec() ) { - qCWarning(lcDb) << "Error SQL statement setFileRecord: " << _setFileRecordQuery->lastQuery() << " :" - << _setFileRecordQuery->error(); return false; } - qCDebug(lcDb) << _setFileRecordQuery->lastQuery() << phash << plen << record._path << record._inode - << QString::number(Utility::qDateTimeToTime_t(record._modtime)) << QString::number(record._type) - << record._etag << record._fileId << record._remotePerm << record._fileSize << (record._serverHasIgnoredFiles ? 1:0) - << record._contentChecksum << record._contentChecksumType << contentChecksumTypeId; - _setFileRecordQuery->reset_and_clear_bindings(); return true; } else { - qCDebug(lcDb) << "Failed to connect database."; + qCWarning(lcDb) << "Failed to connect database."; return false; // checkConnect failed. } } @@ -907,28 +899,22 @@ bool SyncJournalDb::deleteFileRecord(const QString& filename, bool recursively) _deleteFileRecordPhash->bindValue( 1, QString::number(phash) ); if( !_deleteFileRecordPhash->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " - << _deleteFileRecordPhash->lastQuery() - << " : " << _deleteFileRecordPhash->error(); return false; } - qCDebug(lcDb) << _deleteFileRecordPhash->lastQuery() << phash << filename; + _deleteFileRecordPhash->reset_and_clear_bindings(); if( recursively) { _deleteFileRecordRecursively->reset_and_clear_bindings(); _deleteFileRecordRecursively->bindValue(1, filename); if( !_deleteFileRecordRecursively->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " - << _deleteFileRecordRecursively->lastQuery() - << " : " << _deleteFileRecordRecursively->error(); return false; } - qCDebug(lcDb) << _deleteFileRecordRecursively->lastQuery() << filename; + _deleteFileRecordRecursively->reset_and_clear_bindings(); } return true; } else { - qCDebug(lcDb) << "Failed to connect database."; + qCWarning(lcDb) << "Failed to connect database."; return false; // checkConnect failed. } } @@ -946,8 +932,6 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord(const QString& filename) _getFileRecordQuery->bindValue(1, QString::number(phash)); if (!_getFileRecordQuery->exec()) { - QString err = _getFileRecordQuery->error(); - qCDebug(lcDb) << "Error creating prepared statement: " << _getFileRecordQuery->lastQuery() << ", Error:" << err;; locker.unlock(); close(); return rec; @@ -975,7 +959,7 @@ SyncJournalFileRecord SyncJournalDb::getFileRecord(const QString& filename) int errId = _getFileRecordQuery->errorId(); if( errId != SQLITE_DONE ) { // only do this if the problem is different from SQLITE_DONE QString err = _getFileRecordQuery->error(); - qCDebug(lcDb) << "No journal entry found for " << filename << "Error: " << err; + qCWarning(lcDb) << "No journal entry found for " << filename << "Error: " << err; locker.unlock(); close(); locker.relock(); @@ -1001,8 +985,6 @@ bool SyncJournalDb::postSyncCleanup(const QSet& filepathsToKeep, query.prepare("SELECT phash, path FROM metadata order by path"); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err;; return false; } @@ -1026,12 +1008,10 @@ bool SyncJournalDb::postSyncCleanup(const QSet& filepathsToKeep, if( superfluousItems.count() ) { QString sql = "DELETE FROM metadata WHERE phash in ("+ superfluousItems.join(",")+")"; - qCDebug(lcDb) << "Sync Journal cleanup: " << sql; + qCInfo(lcDb) << "Sync Journal cleanup for" << superfluousItems; SqlQuery delQuery(_db); delQuery.prepare(sql); if( !delQuery.exec() ) { - QString err = delQuery.error(); - qCDebug(lcDb) << "Error removing superfluous journal entries: " << delQuery.lastQuery() << ", Error:" << err;; return false; } } @@ -1054,8 +1034,6 @@ int SyncJournalDb::getFileRecordCount() query.prepare("SELECT COUNT(*) FROM metadata"); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err;; return 0; } @@ -1073,9 +1051,11 @@ bool SyncJournalDb::updateFileRecordChecksum(const QString& filename, { QMutexLocker locker(&_mutex); + qCInfo(lcDb) << "Updating file checksum" << filename << contentChecksum << contentChecksumType; + qlonglong phash = getPHash(filename); if( !checkConnect() ) { - qCDebug(lcDb) << "Failed to connect database."; + qCWarning(lcDb) << "Failed to connect database."; return false; } @@ -1088,15 +1068,9 @@ bool SyncJournalDb::updateFileRecordChecksum(const QString& filename, query->bindValue(3, checksumTypeId); if( !query->exec() ) { - qCWarning(lcDb) << "Error SQL statement setFileRecordChecksumQuery: " - << query->lastQuery() << " :" - << query->error(); return false; } - qCDebug(lcDb) << query->lastQuery() << phash << contentChecksum - << contentChecksumType << checksumTypeId; - query->reset_and_clear_bindings(); return true; } @@ -1107,9 +1081,11 @@ bool SyncJournalDb::updateLocalMetadata(const QString& filename, { QMutexLocker locker(&_mutex); + qCInfo(lcDb) << "Updating local metadata for:" << filename << modtime << size << inode; + qlonglong phash = getPHash(filename); if( !checkConnect() ) { - qCDebug(lcDb) << "Failed to connect database."; + qCWarning(lcDb) << "Failed to connect database."; return false; } @@ -1122,15 +1098,9 @@ bool SyncJournalDb::updateLocalMetadata(const QString& filename, query->bindValue(4, size); if( !query->exec() ) { - qCWarning(lcDb) << "Error SQL statement updateLocalMetadata: " - << query->lastQuery() << " :" - << query->error(); return false; } - qCDebug(lcDb) << query->lastQuery() << phash << inode - << modtime << size; - query->reset_and_clear_bindings(); return true; } @@ -1176,9 +1146,6 @@ static bool deleteBatch(SqlQuery & query, const QStringList & entries, const QSt query.reset_and_clear_bindings(); query.bindValue(1, entry); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error removing stale " << qPrintable(name) << " entries: " - << query.lastQuery() << ", Error:" << err; return false; } } @@ -1198,8 +1165,6 @@ SyncJournalDb::DownloadInfo SyncJournalDb::getDownloadInfo(const QString& file) _getDownloadInfoQuery->bindValue(1, file); if (!_getDownloadInfoQuery->exec()) { - QString err = _getDownloadInfoQuery->error(); - qCDebug(lcDb) << "Database error for file " << file << " : " << _getDownloadInfoQuery->lastQuery() << ", Error:" << err;; return res; } @@ -1229,11 +1194,9 @@ void SyncJournalDb::setDownloadInfo(const QString& file, const SyncJournalDb::Do _setDownloadInfoQuery->bindValue(4, i._errorCount ); if( !_setDownloadInfoQuery->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " << _setDownloadInfoQuery->lastQuery() << " :" << _setDownloadInfoQuery->error(); return; } - qCDebug(lcDb) << _setDownloadInfoQuery->lastQuery() << file << i._tmpfile << i._etag << i._errorCount; _setDownloadInfoQuery->reset_and_clear_bindings(); } else { @@ -1241,10 +1204,9 @@ void SyncJournalDb::setDownloadInfo(const QString& file, const SyncJournalDb::Do _deleteDownloadInfoQuery->bindValue( 1, file ); if( !_deleteDownloadInfoQuery->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " << _deleteDownloadInfoQuery->lastQuery() << " : " << _deleteDownloadInfoQuery->error(); return; } - qCDebug(lcDb) << _deleteDownloadInfoQuery->lastQuery() << file; + _deleteDownloadInfoQuery->reset_and_clear_bindings(); } } @@ -1263,8 +1225,6 @@ QVector SyncJournalDb::getAndDeleteStaleDownloadInf query.prepare("SELECT tmpfile, etag, errorcount, path FROM downloadinfo"); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err; return empty_result; } @@ -1317,8 +1277,6 @@ SyncJournalDb::UploadInfo SyncJournalDb::getUploadInfo(const QString& file) _getUploadInfoQuery->bindValue(1, file); if (!_getUploadInfoQuery->exec()) { - QString err = _getUploadInfoQuery->error(); - qCDebug(lcDb) << "Database error for file " << file << " : " << _getUploadInfoQuery->lastQuery() << ", Error:" << err; return res; } @@ -1354,21 +1312,18 @@ void SyncJournalDb::setUploadInfo(const QString& file, const SyncJournalDb::Uplo _setUploadInfoQuery->bindValue(6, Utility::qDateTimeToTime_t(i._modtime) ); if( !_setUploadInfoQuery->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " << _setUploadInfoQuery->lastQuery() << " :" << _setUploadInfoQuery->error(); return; } - qCDebug(lcDb) << _setUploadInfoQuery->lastQuery() << file << i._chunk << i._transferid << i._errorCount; _setUploadInfoQuery->reset_and_clear_bindings(); } else { _deleteUploadInfoQuery->reset_and_clear_bindings(); _deleteUploadInfoQuery->bindValue(1, file); if( !_deleteUploadInfoQuery->exec() ) { - qCWarning(lcDb) << "Exec error of SQL statement: " << _deleteUploadInfoQuery->lastQuery() << " : " << _deleteUploadInfoQuery->error(); return; } - qCDebug(lcDb) << _deleteUploadInfoQuery->lastQuery() << file; + _deleteUploadInfoQuery->reset_and_clear_bindings(); } } @@ -1386,8 +1341,6 @@ QVector SyncJournalDb::deleteStaleUploadInfos(const QSet &keep) query.prepare("SELECT path,transferid FROM uploadinfo"); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err; return ids; } @@ -1429,9 +1382,6 @@ SyncJournalErrorBlacklistRecord SyncJournalDb::errorBlacklistEntry( const QStrin entry._file = file; } _getErrorBlacklistQuery->reset_and_clear_bindings(); - } else { - qCWarning(lcDb) << "Exec error blacklist: " << _getErrorBlacklistQuery->lastQuery() << " : " - << _getErrorBlacklistQuery->error(); } } @@ -1450,8 +1400,6 @@ bool SyncJournalDb::deleteStaleErrorBlacklistEntries(const QSet &keep) query.prepare("SELECT path FROM blacklist"); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err; return false; } @@ -1519,13 +1467,17 @@ void SyncJournalDb::wipeErrorBlacklistEntry( const QString& file ) if( ! query.exec() ) { sqlFail("Deletion of blacklist item failed.", query); } - qCDebug(lcDb) << query.lastQuery() << file; } } void SyncJournalDb::updateErrorBlacklistEntry( const SyncJournalErrorBlacklistRecord& item ) { QMutexLocker locker(&_mutex); + + qCInfo(lcDb) << "Setting blacklist entry for " << item._file << item._retryCount + << item._errorString << item._lastTryTime << item._ignoreDuration + << item._lastTryModtime << item._lastTryEtag << item._renameTarget ; + if( !checkConnect() ) { return; } @@ -1538,13 +1490,7 @@ void SyncJournalDb::updateErrorBlacklistEntry( const SyncJournalErrorBlacklistRe _setErrorBlacklistQuery->bindValue(6, QString::number(item._lastTryTime)); _setErrorBlacklistQuery->bindValue(7, QString::number(item._ignoreDuration)); _setErrorBlacklistQuery->bindValue(8, item._renameTarget); - if( !_setErrorBlacklistQuery->exec() ) { - QString bug = _setErrorBlacklistQuery->error(); - qCDebug(lcDb) << "SQL exec blacklistitem insert or replace failed: "<< bug; - } - qCDebug(lcDb) << "set blacklist entry for " << item._file << item._retryCount - << item._errorString << item._lastTryTime << item._ignoreDuration - << item._lastTryModtime << item._lastTryEtag << item._renameTarget ; + _setErrorBlacklistQuery->exec(); _setErrorBlacklistQuery->reset_and_clear_bindings(); } @@ -1561,8 +1507,6 @@ QVector< SyncJournalDb::PollInfo > SyncJournalDb::getPollInfos() SqlQuery query("SELECT path, modtime, pollpath FROM poll",_db); if (!query.exec()) { - QString err = query.error(); - qCDebug(lcDb) << "Database error :" << query.lastQuery() << ", Error:" << err; return res; } @@ -1589,21 +1533,13 @@ void SyncJournalDb::setPollInfo(const SyncJournalDb::PollInfo& info) qCDebug(lcDb) << "Deleting Poll job" << info._file; SqlQuery query("DELETE FROM poll WHERE path=?", _db); query.bindValue(1, info._file); - if( !query.exec() ) { - qCDebug(lcDb) << "SQL error in setPollInfo: "<< query.error(); - } else { - qCDebug(lcDb) << query.lastQuery() << info._file; - } + query.exec(); } else { SqlQuery query("INSERT OR REPLACE INTO poll (path, modtime, pollpath) VALUES( ? , ? , ? )", _db); query.bindValue(1, info._file); query.bindValue(2, QString::number(info._modtime)); query.bindValue(3, info._url); - if( !query.exec() ) { - qCDebug(lcDb) << "SQL error in setPollInfo: "<< query.error(); - } else { - qCDebug(lcDb) << query.lastQuery() << info._file << info._url; - } + query.exec(); } } @@ -1621,7 +1557,6 @@ QStringList SyncJournalDb::getSelectiveSyncList(SyncJournalDb::SelectiveSyncList _getSelectiveSyncListQuery->reset_and_clear_bindings(); _getSelectiveSyncListQuery->bindValue(1, int(type)); if (!_getSelectiveSyncListQuery->exec()) { - qCWarning(lcDb) << "SQL query failed: "<< _getSelectiveSyncListQuery->error(); *ok = false; return result; } @@ -1674,11 +1609,7 @@ void SyncJournalDb::avoidRenamesOnNextSync(const QString& path) query.prepare("UPDATE metadata SET fileid = '', inode = '0' WHERE path == ?1 OR path LIKE(?2||'/%')"); query.bindValue(1, path); query.bindValue(2, path); - if( !query.exec() ) { - qCDebug(lcDb) << "SQL error in avoidRenamesOnNextSync: "<< query.error(); - } else { - qCDebug(lcDb) << query.lastQuery() << path << "(" << query.numRowsAffected() << " rows)"; - } + query.exec(); // We also need to remove the ETags so the update phase refreshes the directory paths // on the next sync @@ -1702,11 +1633,7 @@ void SyncJournalDb::avoidReadFromDbOnNextSync(const QString& fileName) // This query will match entries for which the path is a prefix of fileName query.prepare("UPDATE metadata SET md5='_invalid_' WHERE ?1 LIKE(path||'/%') AND type == 2;"); // CSYNC_FTW_TYPE_DIR == 2 query.bindValue(1, fileName); - if( !query.exec() ) { - qCDebug(lcDb) << "SQL error in avoidRenamesOnNextSync: "<< query.error(); - } else { - qCDebug(lcDb) << query.lastQuery() << fileName << "(" << query.numRowsAffected() << " rows)"; - } + query.exec(); // Prevent future overwrite of the etag for this sync _avoidReadFromDbOnNextSyncFilter.append(fileName); @@ -1725,14 +1652,10 @@ void SyncJournalDb::forceRemoteDiscoveryNextSync() void SyncJournalDb::forceRemoteDiscoveryNextSyncLocked() { - qCDebug(lcDb) << "Forcing remote re-discovery by deleting folder Etags"; + qCInfo(lcDb) << "Forcing remote re-discovery by deleting folder Etags"; SqlQuery deleteRemoteFolderEtagsQuery(_db); deleteRemoteFolderEtagsQuery.prepare("UPDATE metadata SET md5='_invalid_' WHERE type=2;"); - if( !deleteRemoteFolderEtagsQuery.exec() ) { - qCDebug(lcDb) << "ERROR: Query failed" << deleteRemoteFolderEtagsQuery.error(); - } else { - qCDebug(lcDb) << "Cleared" << deleteRemoteFolderEtagsQuery.numRowsAffected() << "folder ETags"; - } + deleteRemoteFolderEtagsQuery.exec(); } @@ -1748,14 +1671,11 @@ QByteArray SyncJournalDb::getChecksumType(int checksumTypeId) query.reset_and_clear_bindings(); query.bindValue(1, checksumTypeId); if( !query.exec() ) { - qCWarning(lcDb) << "Error SQL statement getChecksumType: " - << query.lastQuery() << " :" - << query.error(); return 0; } if( !query.next() ) { - qCDebug(lcDb) << "No checksum type mapping found for" << checksumTypeId; + qCWarning(lcDb) << "No checksum type mapping found for" << checksumTypeId; return 0; } return query.baValue(0); @@ -1771,9 +1691,6 @@ int SyncJournalDb::mapChecksumType(const QByteArray& checksumType) _insertChecksumTypeQuery->reset_and_clear_bindings(); _insertChecksumTypeQuery->bindValue(1, checksumType); if( !_insertChecksumTypeQuery->exec() ) { - qCWarning(lcDb) << "Error SQL statement insertChecksumType: " - << _insertChecksumTypeQuery->lastQuery() << " :" - << _insertChecksumTypeQuery->error(); return 0; } @@ -1781,14 +1698,11 @@ int SyncJournalDb::mapChecksumType(const QByteArray& checksumType) _getChecksumTypeIdQuery->reset_and_clear_bindings(); _getChecksumTypeIdQuery->bindValue(1, checksumType); if( !_getChecksumTypeIdQuery->exec() ) { - qCWarning(lcDb) << "Error SQL statement getChecksumTypeId: " - << _getChecksumTypeIdQuery->lastQuery() << " :" - << _getChecksumTypeIdQuery->error(); return 0; } if( !_getChecksumTypeIdQuery->next() ) { - qCDebug(lcDb) << "No checksum type mapping found for" << checksumType; + qCWarning(lcDb) << "No checksum type mapping found for" << checksumType; return 0; } return _getChecksumTypeIdQuery->intValue(0); @@ -1803,9 +1717,6 @@ QByteArray SyncJournalDb::dataFingerprint() _getDataFingerprintQuery->reset_and_clear_bindings(); if (!_getDataFingerprintQuery->exec()) { - qCWarning(lcDb) << "Error SQL statement dataFingerprint: " - << _getDataFingerprintQuery->lastQuery() << " :" - << _getDataFingerprintQuery->error(); return QByteArray(); } @@ -1823,30 +1734,18 @@ void SyncJournalDb::setDataFingerprint(const QByteArray &dataFingerprint) } _setDataFingerprintQuery1->reset_and_clear_bindings(); - if (!_setDataFingerprintQuery1->exec()) { - qCWarning(lcDb) << "Error SQL statement setDataFingerprint1: " - << _setDataFingerprintQuery1->lastQuery() << " :" - << _setDataFingerprintQuery1->error(); - } + _setDataFingerprintQuery1->exec(); _setDataFingerprintQuery2->reset_and_clear_bindings(); _setDataFingerprintQuery2->bindValue(1, dataFingerprint); - if (!_setDataFingerprintQuery2->exec()) { - qCWarning(lcDb) << "Error SQL statement setDataFingerprint2: " - << _setDataFingerprintQuery2->lastQuery() << " :" - << _setDataFingerprintQuery2->error(); - } + _setDataFingerprintQuery2->exec(); } void SyncJournalDb::clearFileTable() { SqlQuery query(_db); query.prepare("DELETE FROM metadata;"); - if (!query.exec()) { - qCWarning(lcDb) << "SQL error in clearFileTable" << query.error(); - } else { - qCDebug(lcDb) << query.lastQuery() << "(" << query.numRowsAffected() << " rows)"; - } + query.exec(); } void SyncJournalDb::commit(const QString& context, bool startTrans) diff --git a/src/libsync/utility_unix.cpp b/src/libsync/utility_unix.cpp index b99c60c7fc..b1d3d96d69 100644 --- a/src/libsync/utility_unix.cpp +++ b/src/libsync/utility_unix.cpp @@ -62,12 +62,12 @@ void setLaunchOnStartup_private(const QString &appName, const QString& guiName, QString desktopFileLocation = userAutoStartPath+appName+QLatin1String(".desktop"); if (enable) { if (!QDir().exists(userAutoStartPath) && !QDir().mkpath(userAutoStartPath)) { - qCDebug(lcUtility) << "Could not create autostart folder"; + qCWarning(lcUtility) << "Could not create autostart folder"; return; } QFile iniFile(desktopFileLocation); if (!iniFile.open(QIODevice::WriteOnly)) { - qCDebug(lcUtility) << "Could not write auto start entry" << desktopFileLocation; + qCWarning(lcUtility) << "Could not write auto start entry" << desktopFileLocation; return; } QTextStream ts(&iniFile); @@ -85,7 +85,7 @@ void setLaunchOnStartup_private(const QString &appName, const QString& guiName, ; } else { if (!QFile::remove(desktopFileLocation)) { - qCDebug(lcUtility) << "Could not remove autostart desktop file"; + qCWarning(lcUtility) << "Could not remove autostart desktop file"; } } } diff --git a/src/libsync/utility_win.cpp b/src/libsync/utility_win.cpp index bc392d4d77..b862e2e598 100644 --- a/src/libsync/utility_win.cpp +++ b/src/libsync/utility_win.cpp @@ -43,7 +43,7 @@ static void setupFavLink_private(const QString &folder) } qCDebug(lcUtility) << " creating link from " << linkName << " to " << folder; if (!QFile::link(folder, linkName)) - qCDebug(lcUtility) << "linking" << folder << "to" << linkName << "failed!"; + qCWarning(lcUtility) << "linking" << folder << "to" << linkName << "failed!"; }