Make sure --logfile has precedence on config
authorKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 5 Oct 2020 17:34:46 +0000 (19:34 +0200)
committerMichael Schuster (Rebase PR Action) <misch7@users.noreply.github.com>
Wed, 7 Oct 2020 13:33:20 +0000 (13:33 +0000)
Since we changed the default in the config file and since log dir had
precedence on log file, the --logfile command line option wasn't doing
anything anymore.

We make sure it has an effect again overriding --logdir or the logDir
config entry.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/gui/application.cpp

index 9ac569cbc8c3efe973ebf9d112bc919058caafd3..a408b392bfa5338088f46b83a4f34141a3c0f21d 100644 (file)
@@ -408,7 +408,9 @@ void Application::setupLogging()
     // might be called from second instance
     auto logger = Logger::instance();
     logger->setLogFile(_logFile);
-    logger->setLogDir(!_logDir.isEmpty() ? _logDir : ConfigFile().logDir());
+    if (_logFile.isEmpty()) {
+        logger->setLogDir(_logDir.isEmpty() ? ConfigFile().logDir() : _logDir);
+    }
     logger->setLogExpire(_logExpire > 0 ? _logExpire : ConfigFile().logExpire());
     logger->setLogFlush(_logFlush || ConfigFile().logFlush());
     logger->setLogDebug(_logDebug || ConfigFile().logDebug());