[Libreoffice-commits] online.git: kit/ForKit.cpp wsd/LOOLWSD.cpp wsd/LOOLWSD.hpp

2018-01-07 Thread Ashod Nakashian
 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 
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 
Tested-by: Ashod Nakashian 

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 ForkCounter(0);
 
 static std::map 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 LOOLWSD::SSLEnabled;
 Util::RuntimeConstant LOOLWSD::SSLTermination;
 std::set 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(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(conf, "logging.level", "trace");
+setenv("LOOL_LOGLEVEL", LogLevel.c_str(), true);
 const auto withColor = getConfigValue(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(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 NumConnections;
 static bool TileCachePersistent;
 static std::unique_ptr TraceDumper;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ForKit.cpp wsd/LOOLWSD.cpp

2017-08-10 Thread Jan Holesovsky
 kit/ForKit.cpp  |4 
 wsd/LOOLWSD.cpp |2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 894c5f2cc256d9db69add9c0922dd937e297fb98
Author: Jan Holesovsky 
Date:   Thu Aug 10 11:11:05 2017 +0200

Warn more about missing capabilities, and advise what to do on SLES11.

Change-Id: I93587db6fa32c1c505877c20857799be71ee162f

diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index 5dde307f..32ee85e1 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -501,7 +501,11 @@ int main(int argc, char** argv)
 LOG_INF("Note: LD_BIND_NOW is not set.");
 
 if (!NoCapsForKit && !haveCorrectCapabilities())
+{
+std::cerr << "FATAL: Capabilities are not set for the loolforkit 
program." << std::endl;
+std::cerr << "If you are on SLES11, please set 'file_caps=1' as kernel 
boot option." << std::endl << std::endl;
 return Application::EXIT_SOFTWARE;
+}
 
 // Initialize LoKit
 if (!globalPreinit(loTemplate))
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 17eb4ff6..8cc04d37 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -2597,7 +2597,7 @@ int LOOLWSD::innerMain()
 {
 const auto msg = "Failed to fork child processes.";
 LOG_FTL(msg);
-std::cerr << msg << std::endl;
+std::cerr << "FATAL: " << msg << std::endl;
 throw std::runtime_error(msg);
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: kit/ForKit.cpp wsd/LOOLWSD.cpp

2017-02-14 Thread Miklos Vajna
 kit/ForKit.cpp  |2 ++
 wsd/LOOLWSD.cpp |6 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit f296c0ffeb60e5560eed79246ca877251f279c55
Author: Miklos Vajna 
Date:   Tue Feb 14 09:33:23 2017 +0100

wsd: avoid redundant string initialization

Change-Id: I5ac26d56c3b73e380d26226e83020ace3f1b54f4

diff --git a/kit/ForKit.cpp b/kit/ForKit.cpp
index fa2bebe..ca58e2a 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -44,7 +44,9 @@
 using Poco::Process;
 using Poco::StringTokenizer;
 using Poco::Thread;
+#ifndef KIT_IN_PROCESS
 using Poco::Util::Application;
+#endif
 
 #ifndef KIT_IN_PROCESS
 static bool NoCapsForKit = false;
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index c910f98..a79d631 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -150,9 +150,13 @@ using Poco::Net::SocketAddress;
 using Poco::Net::StreamSocket;
 using Poco::Net::WebSocket;
 using Poco::Path;
+#ifndef KIT_IN_PROCESS
 using Poco::Pipe;
+#endif
 using Poco::Process;
+#ifndef KIT_IN_PROCESS
 using Poco::ProcessHandle;
+#endif
 using Poco::StreamCopier;
 using Poco::StringTokenizer;
 using Poco::TemporaryFile;
@@ -1743,7 +1747,7 @@ bool LOOLWSD::NoCapsForKit = false;
 #endif
 #ifdef FUZZER
 bool LOOLWSD::DummyLOK = false;
-std::string LOOLWSD::FuzzFileName = "";
+std::string LOOLWSD::FuzzFileName;
 #endif
 std::string LOOLWSD::Cache = LOOLWSD_CACHEDIR;
 std::string LOOLWSD::SysTemplate;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits