[Libreoffice-commits] online.git: kit/ForKit.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jan 8 04:52:58 UTC 2018
kit/ForKit.cpp | 16 ++++++++++++++--
wsd/LOOLWSD.cpp | 19 ++++++++++++++++---
wsd/LOOLWSD.hpp | 1 +
3 files changed, 31 insertions(+), 5 deletions(-)
New commits:
commit 94781ec6d989b7f96ac606faeee0fd7fa6fa3bea
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jan 7 22:34:28 2018 -0500
wsd: log at trace level until first child is forked
Change-Id: I1b995b4714738f3bffd6dac58cf90ee6f1a32898
Reviewed-on: https://gerrit.libreoffice.org/47565
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index e399c116..48e4ebb5 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -52,6 +52,7 @@ static bool NoCapsForKit = false;
#endif
static bool DisplayVersion = false;
static std::string UnitTestLibrary;
+static std::string LogLevel;
static std::atomic<unsigned> ForkCounter(0);
static std::map<Process::PID, std::string> childJails;
@@ -245,6 +246,12 @@ static int createLibreOfficeKit(const std::string& childRoot,
LOG_DBG("Forking a loolkit process with jailId: " << jailId << ".");
+ if (LogLevel != "trace")
+ {
+ LOG_INF("Setting log-level to [" << LogLevel << "].");
+ Log::logger().setLevel(LogLevel);
+ }
+
const Process::PID pid = fork();
if (!pid)
{
@@ -376,7 +383,12 @@ int main(int argc, char** argv)
logProperties["path"] = std::string(logFilename);
}
- Log::initialize("frk", logLevel ? logLevel : "", logColor != nullptr, logToFile, logProperties);
+ Log::initialize("frk", "trace", logColor != nullptr, logToFile, logProperties);
+ LogLevel = logLevel ? logLevel : "trace";
+ if (LogLevel != "trace")
+ {
+ LOG_INF("Setting log-level to [trace] and delaying setting to requested [" << LogLevel << "].");
+ }
std::string childRoot;
std::string loSubPath;
@@ -478,7 +490,7 @@ int main(int argc, char** argv)
}
// Setup & check environment
- std::string layers(
+ const std::string layers(
"xcsxcu:${BRAND_BASE_DIR}/share/registry "
"res:${BRAND_BASE_DIR}/share/registry "
"bundledext:${${BRAND_BASE_DIR}/program/lounorc:BUNDLED_EXTENSIONS_USER}/registry/com.sun.star.comp.deployment.configuration.PackageRegistryBackend/configmgr.ini "
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 99174cca..b3336f01 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -562,6 +562,7 @@ std::string LOOLWSD::FileServerRoot;
std::string LOOLWSD::LOKitVersion;
std::string LOOLWSD::ConfigFile = LOOLWSD_CONFIGDIR "/loolwsd.xml";
std::string LOOLWSD::ConfigDir = LOOLWSD_CONFIGDIR "/conf.d";
+std::string LOOLWSD::LogLevel = "trace";
Util::RuntimeConstant<bool> LOOLWSD::SSLEnabled;
Util::RuntimeConstant<bool> LOOLWSD::SSLTermination;
std::set<std::string> LOOLWSD::EditFileExtensions;
@@ -716,8 +717,9 @@ void LOOLWSD::initialize(Application& self)
// Allow UT to manipulate before using configuration values.
UnitWSD::get().configure(config());
- const auto logLevel = getConfigValue<std::string>(conf, "logging.level", "trace");
- setenv("LOOL_LOGLEVEL", logLevel.c_str(), true);
+ // Set the log-level after complete initialization to force maximum details at startup.
+ LogLevel = getConfigValue<std::string>(conf, "logging.level", "trace");
+ setenv("LOOL_LOGLEVEL", LogLevel.c_str(), true);
const auto withColor = getConfigValue<bool>(conf, "logging.color", true) && isatty(fileno(stderr));
if (withColor)
{
@@ -755,7 +757,12 @@ void LOOLWSD::initialize(Application& self)
}
}
- Log::initialize("wsd", logLevel, withColor, logToFile, logProperties);
+ // Log at trace level until we complete the initialization.
+ Log::initialize("wsd", "trace", withColor, logToFile, logProperties);
+ if (LogLevel != "trace")
+ {
+ LOG_INF("Setting log-level to [trace] and delaying setting to requested [" << LogLevel << "].");
+ }
#if ENABLE_SSL
LOOLWSD::SSLEnabled.set(getConfigValue<bool>(conf, "ssl.enable", true));
@@ -2713,6 +2720,12 @@ int LOOLWSD::innerMain()
}
#endif
+ if (LogLevel != "trace")
+ {
+ LOG_INF("Setting log-level to [" << LogLevel << "].");
+ Log::logger().setLevel(LogLevel);
+ }
+
// Start the server.
srv.start(ClientPortNumber);
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 40a32b73..9e388a6c 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -55,6 +55,7 @@ public:
static std::string ServerName;
static std::string FileServerRoot;
static std::string LOKitVersion;
+ static std::string LogLevel;
static std::atomic<unsigned> NumConnections;
static bool TileCachePersistent;
static std::unique_ptr<TraceFileWriter> TraceDumper;
More information about the Libreoffice-commits
mailing list