{
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;
}
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
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() ) {
// 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);
}
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)
// 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';
if (acc->_am) {
CookieJar* jar = qobject_cast<CookieJar*>(acc->_am->cookieJar());
if (jar) {
- qCDebug(lcAccountManager) << "Saving cookies." << acc->cookieJarPath();
+ qCInfo(lcAccountManager) << "Saving cookies." << acc->cookieJarPath();
jar->save(acc->cookieJarPath());
}
}
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();
}
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();
FolderWizard *folderWizard = qobject_cast<FolderWizard*>(sender());
FolderMan *folderMan = FolderMan::instance();
- qCDebug(lcAccountSettings) << "* Folder wizard completed";
+ qCInfo(lcAccountSettings) << "Folder wizard completed";
FolderDefinition definition;
definition.localPath = FolderDefinition::prepareLocalPath(
{
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("<p>Could not create local folder <i>%1</i>.")
void AccountSettings::slotFolderWizardRejected()
{
- qCDebug(lcAccountSettings) << "* Folder wizard cancelled";
+ qCInfo(lcAccountSettings) << "Folder wizard cancelled";
FolderMan *folderMan = FolderMan::instance();
folderMan->setSyncEnabled(true);
}
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,
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;
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;
}
}
}
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;
}
if (_connectionValidator) {
- qCDebug(lcAccountState) << "ConnectionValidator already running, ignoring" << account()->displayName();
+ qCWarning(lcAccountState) << "ConnectionValidator already running, ignoring" << account()->displayName();
return;
}
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;
}
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;
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();
}
snh->slotFetchNotifications(ptr);
} else {
- qCDebug(lcActivity) << "========> notification request counter not zero.";
+ qCWarning(lcActivity) << "Notification request counter not zero.";
}
}
foreach( auto activity, list ) {
if( _blacklistedNotifications.contains(activity)) {
- qCDebug(lcActivity) << "Activity in blacklist, skip";
+ qCInfo(lcActivity) << "Activity in blacklist, skip";
continue;
}
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<NotificationWidget*>(sender());
const QStringList validVerbs = QStringList() << "GET" << "PUT" << "POST" << "DELETE";
_notificationRequestsRunning++;
}
} else {
- qCDebug(lcActivity) << "Notification Links: Invalid verb:" << verb;
+ qCWarning(lcActivity) << "Notification Links: Invalid verb:" << verb;
}
}
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;
}
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
// 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() ) {
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)
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) );
// (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"),
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";
// 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;
}
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.";
}
}
{
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();
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('/');
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;
}
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();
}
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;
}
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,
_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();
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
}
}
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
void Folder::slotTerminateSync()
{
- qCDebug(lcFolder) << "folder " << alias() << " Terminating!";
+ qCInfo(lcFolder) << "folder " << alias() << " Terminating!";
if( _engine->isSyncRunning() ) {
_engine->abort();
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
// 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);
}
_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());
void Folder::slotSyncStarted()
{
- qCDebug(lcFolder) << "#### Propagation start #################################################### >>";
+ qCInfo(lcFolder) << "#### Propagation start ####################################################";
_syncResult.setStatus(SyncResult::SyncRunning);
emit syncStateChange();
}
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()
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();
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 ) {
else
{
_consecutiveFailingSyncs++;
- qCDebug(lcFolder) << "the last" << _consecutiveFailingSyncs << "syncs failed";
+ qCInfo(lcFolder) << "the last" << _consecutiveFailingSyncs << "syncs failed";
}
if (_syncResult.status() == SyncResult::Success && 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;
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();
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();
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 '.'
{
// 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 "
{
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
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.
}
if (!accountState) {
- qCWarning(lcFolderMan) << "can't create folder without an account";
+ qCCritical(lcFolderMan) << "can't create folder without an account";
return 0;
}
folder->saveToSettings();
}
- qCDebug(lcFolderMan) << "Migrated!" << folder;
+ qCInfo(lcFolderMan) << "Migrated!" << folder;
settings.sync();
return folder;
}
void FolderMan::slotFolderSyncPaused( Folder *f, bool paused )
{
if( !f ) {
- qCWarning(lcFolderMan) << "!! slotFolderSyncPaused called with empty folder";
+ qCCritical(lcFolderMan) << "slotFolderSyncPaused called with empty folder";
return;
}
void FolderMan::slotScheduleAppRestart()
{
_appRestartRequired = true;
- qCDebug(lcFolderMan) << "## Application restart requested!";
+ qCInfo(lcFolderMan) << "Application restart requested!";
}
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;
}
_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();
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;
}
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
}
}
} else {
- qCDebug(lcFolderMan) << "Account" << accountName << "disconnected or paused, "
+ qCInfo(lcFolderMan) << "Account" << accountName << "disconnected or paused, "
"terminating or descheduling sync folders";
if (_currentSyncFolder
// 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);
}
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;
}
{
// 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) {
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";
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()
void FolderMan::slotFolderSyncStarted( )
{
- qCDebug(lcFolderMan) << ">===================================== sync started for " << _currentSyncFolder->remoteUrl().toString();
+ qCInfo(lcFolderMan) << ">===================================== sync started for " << _currentSyncFolder->remoteUrl().toString();
}
/*
*/
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;
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);
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 ) {
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;
}
{
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();
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;
}
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);
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;
}
// 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) {
// 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;
return;
}
- qCDebug(lcFolderWatcher) << "detected changes in paths:" << changedPaths;
+ qCInfo(lcFolderWatcher) << "Detected changes in paths:" << changedPaths;
foreach (const QString &path, changedPaths) {
emit pathChanged(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));
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()) {
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;
}
emit changed(_path);
*increaseBufferSize = true;
} else {
- qCDebug(lcFolderWatcher) << "ReadDirectoryChangesW error" << errorCode;
+ qCWarning(lcFolderWatcher) << "ReadDirectoryChangesW error" << errorCode;
}
break;
}
break;
}
if (result != 0) {
- qCDebug(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << GetLastError();
+ qCWarning(lcFolderWatcher) << "WaitForMultipleObjects failed" << result << GetLastError();
break;
}
emit changed(_path);
*increaseBufferSize = true;
} else {
- qCDebug(lcFolderWatcher) << "GetOverlappedResult error" << errorCode;
+ qCWarning(lcFolderWatcher) << "GetOverlappedResult error" << errorCode;
}
break;
}
if (longNameSize > 0) {
longfile = QString::fromUtf16(reinterpret_cast<const ushort *>(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);
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 {
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
// 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;
}
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;
_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 );
}
// 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);
}
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
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
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
_settingsDialog->close();
}
} else {
- qCDebug(lcApplication) << "No configured folders yet, starting setup wizard";
+ qCInfo(lcApplication) << "No configured folders yet, starting setup wizard";
slotNewAccountWizard();
}
}
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();
if (platformMenu
&& platformMenu->metaObject()->className() == QLatin1String("QDBusPlatformMenu")) {
_qdbusmenuWorkaround = true;
- qCDebug(lcApplication) << "Enabled QDBusPlatformMenu workaround";
+ qCWarning(lcApplication) << "Enabled QDBusPlatformMenu workaround";
}
}
#endif
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)
{
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
{
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;
}
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 );
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);
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);
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 );
// 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();
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;
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;
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;
}
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!");
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
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);
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()
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;
}
}
- qCDebug(lcProxy) << "got creds for" << _proxy;
+ qCInfo(lcProxy) << "got creds for" << _proxy;
authenticator->setUser(_username);
authenticator->setPassword(_password);
sending_qnam = qnam_alive.data();
--_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;
--_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;
}
return;
}
- qCDebug(lcProxy) << "storing" << _proxy;
+ qCInfo(lcProxy) << "storing" << _proxy;
_settings->setValue(keychainUsernameKey(), _username);
job->deleteLater();
if (job->error() != NoError) {
- qCDebug(lcProxy) << "WritePasswordJob failed with" << job->errorString();
+ qCWarning(lcProxy) << "WritePasswordJob failed with" << job->errorString();
}
}
// 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;
}
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;
}
const QVariant receivedPermissions = result["share-permissions"];
if (!receivedPermissions.toString().isEmpty()) {
_maxSharingPermissions = static_cast<SharePermissions>(receivedPermissions.toInt());
- qCDebug(lcSharing) << "Received sharing permissions for" << _sharePath << _maxSharingPermissions;
+ qCInfo(lcSharing) << "Received sharing permissions for" << _sharePath << _maxSharingPermissions;
}
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;
}
//
// _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;
}
void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &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;
_pi_password->stopAnimation();
_pi_editing->stopAnimation();
- qCDebug(lcSharing) << "Error from server" << code << message;
+ qCWarning(lcSharing) << "Error from server" << code << message;
displayError(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);
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'));
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;
}
}
#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);
}
}
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()));
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*)));
void SocketApi::onLostConnection()
{
- qCDebug(lcSocketApi) << "Lost connection " << sender();
+ qCInfo(lcSocketApi) << "Lost connection " << sender();
sender()->deleteLater();
}
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;
}
}
}
{
(void) conf;
if (!certs) {
- qCDebug(lcSslErrorDialog) << "Certs parameter required but is NULL!";
+ qCCritical(lcSslErrorDialog) << "Certs parameter required but is NULL!";
return false;
}
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;
}
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;
}
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;
}
}
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");
}
QNetworkReply *reply = qobject_cast<QNetworkReply*>(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;
}
if( ok ) {
versionInfoArrived(_updateInfo);
} else {
- qCDebug(lcUpdater) << "Could not parse update information.";
+ qCWarning(lcUpdater) << "Could not parse update information.";
}
}
_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());
|| 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();
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);
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;
}
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);
_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);
}
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);
bool discard = finished();
if (discard) {
+ qCDebug(lcNetworkJob) << "Network job" << metaObject()->className() << "finished for" << path();
deleteLater();
}
}
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()
// 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<QSslCertificate> 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;
}
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
#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
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;
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) {
}
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()) {
#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();
}
}
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;
}
{
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();
}
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;
}
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;
}
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;
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);
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;
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;
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;
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);
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 << ")";
void ConnectionValidator::slotNoStatusFound(QNetworkReply *reply)
{
auto job = qobject_cast<CheckServerJob *>(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
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;
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
{
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;
}
}
#endif
if (_clientSslKey.isNull()) {
- qCDebug(lcHttpCredentials) << "Warning: Could not load SSL key into Qt!";
+ qCWarning(lcHttpCredentials) << "Could not load SSL key into Qt!";
}
}
_password = job->textData();
if( _user.isEmpty()) {
- qCDebug(lcHttpCredentials) << "Strange: User is empty!";
+ qCWarning(lcHttpCredentials) << "Strange: User is empty!";
}
QKeychain::Error error = job->error();
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;
}
case NoError:
break;
default:
- qCDebug(lcHttpCredentials) << "Error while writing password" << job->errorString();
+ qCWarning(lcHttpCredentials) << "Error while writing password" << job->errorString();
}
WritePasswordJob *wjob = qobject_cast<WritePasswordJob*>(job);
wjob->deleteLater();
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();
}
void TokenCredentials::invalidateToken()
{
- qCDebug(lcTokenCredentials) << "Invalidating token";
+ qCInfo(lcTokenCredentials) << "Invalidating token";
_ready = false;
_account->clearCookieJar();
_token = QString();
// 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();
}
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") {
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
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) {
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;
}
&& (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());
}
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;
}
}
if (!success) {
- qCDebug(lcFileSystem) << "FAIL: renaming file" << originFileName
+ qCWarning(lcFileSystem) << "Error renaming file" << originFileName
<< "to" << destinationFileName
<< "failed: " << error;
if (errorString) {
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;
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 ) {
#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;
}
(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;
}
&& (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;
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)
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());
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;
}
// 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;
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);
QList<QByteArray> properties = _properties;
if (properties.isEmpty()) {
- qCWarning(lcLsCol) << "Propfind with no properties!";
+ qCWarning(lcLsColJob) << "Propfind with no properties!";
}
QByteArray propStr;
foreach (const QByteArray &prop, properties) {
// 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")) {
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();
}
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
_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());
}
}
QList<QByteArray> 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
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) {
}
}
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());
}
if( pngData.size() ) {
if( avImage.loadFromData(pngData) ) {
- qCDebug(lcAvatar) << "Retrieved Avatar pixmap!";
+ qCDebug(lcAvatarJob) << "Retrieved Avatar pixmap!";
}
}
}
void ProppatchJob::start()
{
if (_properties.isEmpty()) {
- qCWarning(lcProppatch) << "Proppatch with no properties!";
+ qCWarning(lcProppatchJob) << "Proppatch with no properties!";
}
QNetworkRequest req;
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();
}
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;
}
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;
}
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;
}
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;
// 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;
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);
connect(_rootJob.data(), SIGNAL(finished(SyncFileItem::Status)), this, SLOT(emitFinished(SyncFileItem::Status)));
- qCDebug(lcPropagator) << "Using QNAM/HTTP parallel code path";
-
scheduleNextJob();
}
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
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;
}
}
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);
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";
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();
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;
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;
}
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;
}
// 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);
}
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;
}
bool SqlQuery::exec()
{
+ qCDebug(lcSql) << "SQL exec" << _sql;
+
if (!_stmt) {
+ qCWarning(lcSql) << "Can't exec query, statement unprepared.";
return false;
}
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
}
void SqlQuery::bindValue(int pos, const QVariant& value)
{
+ qCDebug(lcSql) << "SQL bind" << pos << value;
+
int res = -1;
if (!_stmt) {
ASSERT(false);
break; }
}
if (res != SQLITE_OK) {
- qCDebug(lcSql) << "ERROR" << value << res;
+ qCWarning(lcSql) << "ERROR binding SQL value:" << value << "error:" << res;
}
ASSERT( res == SQLITE_OK );
}
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.
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;
}
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()));
_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;
}
}
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();
void GETFileJob::giveBandwidthQuota(qint64 q)
{
_bandwidthQuota = q;
- qCDebug(lcGetFile) << "Got" << q << "bytes";
+ qCDebug(lcGetJob) << "Got" << q << "bytes";
QMetaObject::invokeMethod(this, "slotReadyRead", Qt::QueuedConnection);
}
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;
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;
}
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;
}
}
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;
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");
_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;
&_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();
GETFileJob *job = qobject_cast<GETFileJob *>(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();
// 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
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;
}
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);
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);
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:
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;
}
}
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;
}
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;
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();
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,
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;
}
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();
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
}
}
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)
/**
}
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)));
}
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) {
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;
}
namespace OCC {
+Q_DECLARE_LOGGING_CATEGORY(lcPutJob)
Q_DECLARE_LOGGING_CATEGORY(lcPropagateUpload)
class BandwidthManager;
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;
}
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;
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.
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) {
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;
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";
} 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;
}
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";
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.
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) {
#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;
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;
}
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) {
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;
#include <QElapsedTimer>
#include <qtextcodec.h>
-extern "C" const char *csync_instruction_str(enum csync_instructions_e instr);
-
namespace OCC {
Q_LOGGING_CATEGORY(lcEngine, "sync.engine")
bool SyncEngine::checkErrorBlacklisting( SyncFileItem &item )
{
if( !_journal ) {
- qCWarning(lcEngine) << "Journal is undefined!";
+ qCCritical(lcEngine) << "Journal is undefined!";
return false;
}
// 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;
}
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;
_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);
}
}
// 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;
}
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();
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()));
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;
return;
}
} else {
- qCDebug(lcEngine) << "Could not determine free space available at" << _localPath;
+ qCWarning(lcEngine) << "Could not determine free space available at" << _localPath;
}
_syncItemMap.clear();
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 ");
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;
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;
_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
_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)));
_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;
void SyncEngine::slotRootEtagReceived(const QString &e) {
if (_remoteRootEtag.isEmpty()) {
- qCDebug(lcEngine) << e;
+ qCDebug(lcEngine) << "Root etag:" << e;
_remoteRootEtag = e;
emit rootEtag(_remoteRootEtag);
}
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;
return;
}
- qCDebug(lcEngine) << "<<#### Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Reconcile Finished"));
+ qCInfo(lcEngine) << "#### Reconcile end #################################################### " << _stopWatch.addLapTime(QLatin1String("Reconcile Finished")) << "ms";
_hasNoneFiles = false;
_hasRemoveFile = false;
_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
}
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;
}
// 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);
#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";
_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)
;
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) {
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;
// 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");
// 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;
}
} 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");
// 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;
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;
continue;
}
- qCDebug(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file;
+ qCWarning(lcEngine) << "checkForPermission: RESTORING" << (*it)->_file;
(*it)->_instruction = CSYNC_INSTRUCTION_NEW;
(*it)->_direction = SyncFileItem::Down;
(*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
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
(*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;
}
}
}
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;
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;
}
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";
}
}
{
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!";
}
{
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";
}
// 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
}
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;
}
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
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
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;");
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);");
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;
}
// 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;
}
bool rc = updateDatabaseStructure();
if( !rc ) {
- qCDebug(lcDb) << "WARN: Failed to update the database structure!";
+ qCWarning(lcDb) << "Failed to update the database structure!";
}
/*
void SyncJournalDb::close()
{
QMutexLocker locker(&_mutex);
- qCDebug(lcDb) << "Closing DB" << _dbFile;
+ qCInfo(lcDb) << "Closing DB" << _dbFile;
commitTransaction();
query.prepare(q);
if(!query.exec()) {
- QString err = query.error();
- qCDebug(lcDb) << "Error creating prepared statement: " << query.lastQuery() << ", Error:" << err;;
return columns;
}
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();
_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.
}
}
_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.
}
}
_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;
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();
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;
}
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;
}
}
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;
}
{
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;
}
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;
}
{
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;
}
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;
}
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;
}
}
_getDownloadInfoQuery->bindValue(1, file);
if (!_getDownloadInfoQuery->exec()) {
- QString err = _getDownloadInfoQuery->error();
- qCDebug(lcDb) << "Database error for file " << file << " : " << _getDownloadInfoQuery->lastQuery() << ", Error:" << err;;
return res;
}
_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 {
_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();
}
}
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;
}
_getUploadInfoQuery->bindValue(1, file);
if (!_getUploadInfoQuery->exec()) {
- QString err = _getUploadInfoQuery->error();
- qCDebug(lcDb) << "Database error for file " << file << " : " << _getUploadInfoQuery->lastQuery() << ", Error:" << err;
return res;
}
_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();
}
}
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;
}
entry._file = file;
}
_getErrorBlacklistQuery->reset_and_clear_bindings();
- } else {
- qCWarning(lcDb) << "Exec error blacklist: " << _getErrorBlacklistQuery->lastQuery() << " : "
- << _getErrorBlacklistQuery->error();
}
}
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;
}
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;
}
_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();
}
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;
}
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();
}
}
_getSelectiveSyncListQuery->reset_and_clear_bindings();
_getSelectiveSyncListQuery->bindValue(1, int(type));
if (!_getSelectiveSyncListQuery->exec()) {
- qCWarning(lcDb) << "SQL query failed: "<< _getSelectiveSyncListQuery->error();
*ok = false;
return result;
}
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
// 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);
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();
}
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);
_insertChecksumTypeQuery->reset_and_clear_bindings();
_insertChecksumTypeQuery->bindValue(1, checksumType);
if( !_insertChecksumTypeQuery->exec() ) {
- qCWarning(lcDb) << "Error SQL statement insertChecksumType: "
- << _insertChecksumTypeQuery->lastQuery() << " :"
- << _insertChecksumTypeQuery->error();
return 0;
}
_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);
_getDataFingerprintQuery->reset_and_clear_bindings();
if (!_getDataFingerprintQuery->exec()) {
- qCWarning(lcDb) << "Error SQL statement dataFingerprint: "
- << _getDataFingerprintQuery->lastQuery() << " :"
- << _getDataFingerprintQuery->error();
return QByteArray();
}
}
_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)
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);
;
} else {
if (!QFile::remove(desktopFileLocation)) {
- qCDebug(lcUtility) << "Could not remove autostart desktop file";
+ qCWarning(lcUtility) << "Could not remove autostart desktop file";
}
}
}
}
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!";
}