diff --git a/src/csync/csync_exclude.cpp b/src/csync/csync_exclude.cpp index bddb3047e0..9efe50df39 100644 --- a/src/csync/csync_exclude.cpp +++ b/src/csync/csync_exclude.cpp @@ -442,7 +442,9 @@ CSYNC_EXCLUDE_TYPE ExcludedFiles::traversalPatternMatch(const QString &path, Ite addExcludeFilePath(absolutePath); reloadExcludeFiles(); } else { +#if !defined QT_NO_DEBUG qWarning() << "System exclude list file could not be read:" << absolutePath; +#endif } } diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp index b657ecaa60..4b1dab50e5 100644 --- a/src/gui/socketapi/socketapi.cpp +++ b/src/gui/socketapi/socketapi.cpp @@ -316,7 +316,7 @@ void SocketApi::slotNewConnection() if (!socket) { return; } - qCInfo(lcSocketApi) << "New connection" << socket; + qCDebug(lcSocketApi) << "New connection" << socket; connect(socket, &QIODevice::readyRead, this, &SocketApi::slotReadSocket); connect(socket, SIGNAL(disconnected()), this, SLOT(onLostConnection())); connect(socket, &QObject::destroyed, this, &SocketApi::slotSocketDestroyed); @@ -327,7 +327,7 @@ void SocketApi::slotNewConnection() for (Folder *f : FolderMan::instance()->map()) { if (f->canSync()) { QString message = buildRegisterPathMessage(removeTrailingSlash(f->path())); - qCInfo(lcSocketApi) << "Trying to send SocketAPI Register Path Message -->" << message << "to" << listener->socket; + qCDebug(lcSocketApi) << "Trying to send SocketAPI Register Path Message -->" << message << "to" << listener->socket; listener->sendMessage(message); } } @@ -366,7 +366,7 @@ void SocketApi::slotReadSocket() // Make sure to normalize the input from the socket to // make sure that the path will match, especially on OS X. const QString line = QString::fromUtf8(socket->readLine().trimmed()).normalized(QString::NormalizationForm_C); - qCInfo(lcSocketApi) << "Received SocketAPI message <--" << line << "from" << socket; + qCDebug(lcSocketApi) << "Received SocketAPI message <--" << line << "from" << socket; const int argPos = line.indexOf(QLatin1Char(':')); const QByteArray command = line.midRef(0, argPos).toUtf8().toUpper(); const int indexOfMethod = [&] { diff --git a/src/gui/tray/activitylistmodel.cpp b/src/gui/tray/activitylistmodel.cpp index a917a580a6..8e5f3e45b7 100644 --- a/src/gui/tray/activitylistmodel.cpp +++ b/src/gui/tray/activitylistmodel.cpp @@ -558,7 +558,7 @@ void ActivityListModel::addEntriesToActivityList(const ActivityList &activityLis void ActivityListModel::addErrorToActivityList(const Activity &activity, const ErrorType type) { - qCInfo(lcActivity) << "Error successfully added to the notification list: " << type << activity._message << activity._subject << activity._syncResultStatus << activity._syncFileItemStatus; + qCDebug(lcActivity) << "Error successfully added to the notification list: " << type << activity._message << activity._subject << activity._syncResultStatus << activity._syncFileItemStatus; auto modifiedActivity = activity; if (type == ErrorType::NetworkError) { modifiedActivity._subject = tr("Network error occurred: client will retry syncing."); @@ -594,14 +594,14 @@ void ActivityListModel::addIgnoredFileToList(const Activity &newActivity) void ActivityListModel::addNotificationToActivityList(const Activity &activity) { - qCInfo(lcActivity) << "Notification successfully added to the notification list: " << activity._subject; + qCDebug(lcActivity) << "Notification successfully added to the notification list: " << activity._subject; addEntriesToActivityList({activity}); _notificationLists.prepend(activity); } void ActivityListModel::addSyncFileItemToActivityList(const Activity &activity) { - qCInfo(lcActivity) << "Successfully added to the activity list: " << activity._subject; + qCDebug(lcActivity) << "Successfully added to the activity list: " << activity._subject; addEntriesToActivityList({activity}); _syncFileItemLists.prepend(activity); } diff --git a/src/libsync/bandwidthmanager.cpp b/src/libsync/bandwidthmanager.cpp index f5fc3582bc..358822e6be 100644 --- a/src/libsync/bandwidthmanager.cpp +++ b/src/libsync/bandwidthmanager.cpp @@ -286,7 +286,7 @@ void BandwidthManager::relativeDownloadMeasuringTimerExpired() auto quota = relativeLimitProgressDifference * (downloadLimitPercent / 100.0); if (quota > 20 * 1024) { - qCInfo(lcBandwidthManager) << "ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20 * 1024; + qCDebug(lcBandwidthManager) << "ADJUSTING QUOTA FROM " << quota << " TO " << quota - 20 * 1024; quota -= 20 * 1024; } diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 81e180934d..e50817cb36 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -430,7 +430,6 @@ void ProcessDirectoryJob::processFile(PathTuple path, << " | checksum: " << dbEntry._checksumHeader << "//" << serverEntry.checksumHeader << " | perm: " << dbEntry._remotePerm << "//" << serverEntry.remotePerm << " | fileid: " << dbEntry._fileId << "//" << serverEntry.fileId - << " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/" << " | type: " << dbEntry._type << "/" << localEntry.type << "/" << (serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile) << " | e2ee: " << dbEntry.isE2eEncrypted() << "/" << serverEntry.isE2eEncrypted() << " | e2eeMangledName: " << dbEntry.e2eMangledName() << "/" << serverEntry.e2eMangledName @@ -553,7 +552,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( item->_lockEditorApp = serverEntry.lockEditorApp; item->_lockTime = serverEntry.lockTime; item->_lockTimeout = serverEntry.lockTimeout; - qCInfo(lcDisco()) << item->_locked << item->_lockOwnerDisplayName << item->_lockOwnerId << item->_lockOwnerType << item->_lockEditorApp << item->_lockTime << item->_lockTimeout; + qCDebug(lcDisco()) << item->_locked << item->_lockOwnerDisplayName << item->_lockOwnerId << item->_lockOwnerType << item->_lockEditorApp << item->_lockTime << item->_lockTimeout; // Check for missing server data { @@ -582,7 +581,7 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( // Add on a second as a precaution, sometimes we catch the server before it has had a chance to update const auto lockExpirationTimeout = qMax(5LL, timeRemaining + 1); - qCInfo(lcDisco) << "File:" << path._original << "is locked." + qCDebug(lcDisco) << "File:" << path._original << "is locked." << "Lock expires in:" << lockExpirationTimeout << "seconds." << "A sync run will be scheduled for around that time."; @@ -952,7 +951,9 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( // Not modified locally (ParentNotChanged) if (noServerEntry) { // not on the server: Removed on the server, delete locally +#if !defined QT_NO_DEBUG qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally."; +#endif item->_instruction = CSYNC_INSTRUCTION_REMOVE; item->_direction = SyncFileItem::Down; } else if (dbEntry._type == ItemTypeVirtualFileDehydration) { @@ -980,7 +981,9 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( } else if (!serverModified) { // Removed locally: also remove on the server. if (!dbEntry._serverHasIgnoredFiles) { +#if !defined QT_NO_DEBUG qCInfo(lcDisco) << "File" << item->_file << "was deleted locally. Going to delete it on the server."; +#endif item->_instruction = CSYNC_INSTRUCTION_REMOVE; item->_direction = SyncFileItem::Up; } @@ -1019,7 +1022,9 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( } else if (!typeChange && ((dbEntry._modtime == localEntry.modtime && dbEntry._fileSize == localEntry.size) || localEntry.isDirectory)) { // Local file unchanged. if (noServerEntry) { +#if !defined QT_NO_DEBUG qCInfo(lcDisco) << "File" << item->_file << "is not anymore on server. Going to delete it locally."; +#endif item->_instruction = CSYNC_INSTRUCTION_REMOVE; item->_direction = SyncFileItem::Down; } else if (dbEntry._type == ItemTypeVirtualFileDehydration || localEntry.type == ItemTypeVirtualFileDehydration) { @@ -1538,7 +1543,7 @@ void ProcessDirectoryJob::processFileFinalize( item->_direction = _dirItem->_direction; } - qCInfo(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->_type; + qCDebug(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->_type; if (item->isDirectory() && item->_instruction == CSYNC_INSTRUCTION_SYNC) item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA; diff --git a/src/libsync/logger.cpp b/src/libsync/logger.cpp index cab592adfd..fffbbc14c6 100644 --- a/src/libsync/logger.cpp +++ b/src/libsync/logger.cpp @@ -36,7 +36,7 @@ namespace { constexpr int CrashLogSize = 20; -constexpr int MaxLogSizeBytes = 1024 * 1024 * 30; +constexpr auto MaxLogLinesCount = 50000; static bool compressLog(const QString &originalName, const QString &targetName) { @@ -118,7 +118,8 @@ bool Logger::isLoggingToFile() const void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString &message) { - const QString msg = qFormatLogMessage(type, ctx, message); + static long long int linesCounter = 0; + const auto &msg = qFormatLogMessage(type, ctx, message); #if defined(Q_OS_WIN) && defined(QT_DEBUG) // write logs to Output window of Visual Studio { @@ -146,10 +147,12 @@ void Logger::doLog(QtMsgType type, const QMessageLogContext &ctx, const QString { QMutexLocker lock(&_mutex); - if (_logFile.size() >= MaxLogSizeBytes) { + if (linesCounter >= MaxLogLinesCount) { + linesCounter = 0; closeNoLock(); enterNextLogFileNoLock(); } + ++linesCounter; _crashLogIndex = (_crashLogIndex + 1) % CrashLogSize; _crashLog[_crashLogIndex] = msg; diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index b82f80a7c0..2edd3c4c5b 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -306,7 +306,7 @@ void GETFileJob::slotReadyRead() if (_bandwidthLimited) { toRead = qMin(qint64(bufferSize), _bandwidthQuota); if (toRead == 0) { - qCWarning(lcGetJob) << "Out of quota"; + qCDebug(lcGetJob) << "Out of quota"; break; } _bandwidthQuota -= toRead; diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index f162b0ed5a..5f955ac0dd 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -624,7 +624,7 @@ void SyncEngine::startSync() _discoveryPhase->_syncOptions = _syncOptions; _discoveryPhase->_shouldDiscoverLocaly = [this](const QString &path) { const auto result = shouldDiscoverLocally(path); - qCInfo(lcEngine) << "shouldDiscoverLocaly" << path << (result ? "true" : "false"); + qCDebug(lcEngine) << "shouldDiscoverLocaly" << path << (result ? "true" : "false"); return result; }; _discoveryPhase->setSelectiveSyncBlackList(selectiveSyncBlackList); diff --git a/src/libsync/syncfilestatustracker.cpp b/src/libsync/syncfilestatustracker.cpp index 7d03fba32e..6117ef2239 100644 --- a/src/libsync/syncfilestatustracker.cpp +++ b/src/libsync/syncfilestatustracker.cpp @@ -226,7 +226,7 @@ void SyncFileStatusTracker::slotAboutToPropagate(SyncFileItemVector &items) std::swap(_syncProblems, oldProblems); foreach (const SyncFileItemPtr &item, items) { - qCDebug(lcStatusTracker) << "Investigating" << item->destination() << item->_status << item->_instruction << item->_direction; + qCInfo(lcStatusTracker) << "Investigating" << item->destination() << item->_status << item->_instruction << item->_direction; _dirtyPaths.remove(item->destination()); if (hasErrorStatus(*item)) {