Change the defaults for logging
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 5 Oct 2020 15:48:30 +0000 (17:48 +0200)
committerMichael Schuster (Rebase PR Action) <misch7@users.noreply.github.com>
Wed, 7 Oct 2020 13:33:20 +0000 (13:33 +0000)
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 <kevin.ottens@nextcloud.com>
src/libsync/configfile.cpp

index c4e81110cdaf70fb4fbbe0ee124c4c2d2f7da482..da4aca58e1bd1ba26fe7c35d004306edd779496c 100644 (file)
@@ -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)