From: Kevin Ottens Date: Mon, 5 Oct 2020 15:48:30 +0000 (+0200) Subject: Change the defaults for logging X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~22^2~121^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=b0a38816fc507c8f06f38c2bc2ecae8c153b8b87;p=nextcloud-desktop.git Change the defaults for logging Turn on the logging by default for everyone. Let's use a log dir within the config directory of the application and have debug logs expiring after a day. This obviously means we'll generate quite some logs but with the automated compression it shouldn't be too horrible. Obviously that scales with the amount of files and syncs occurring. In our tests with a large setup we're around 100 MB for a day worth of logs, this shouldn't be too much of an issue on today's average desktop/laptop. Signed-off-by: Kevin Ottens --- diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index c4e81110c..da4aca58e 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -901,8 +901,9 @@ void ConfigFile::setAutomaticLogDir(bool enabled) QString ConfigFile::logDir() const { + const auto defaultLogDir = QString(configPath() + QStringLiteral("/logs")); QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logDirC), QString()).toString(); + return settings.value(QLatin1String(logDirC), defaultLogDir).toString(); } void ConfigFile::setLogDir(const QString &dir) @@ -914,7 +915,7 @@ void ConfigFile::setLogDir(const QString &dir) bool ConfigFile::logDebug() const { QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logDebugC), false).toBool(); + return settings.value(QLatin1String(logDebugC), true).toBool(); } void ConfigFile::setLogDebug(bool enabled) @@ -926,7 +927,7 @@ void ConfigFile::setLogDebug(bool enabled) int ConfigFile::logExpire() const { QSettings settings(configFile(), QSettings::IniFormat); - return settings.value(QLatin1String(logExpireC), 0).toBool(); + return settings.value(QLatin1String(logExpireC), 24).toBool(); } void ConfigFile::setLogExpire(int hours)