[Libreoffice-commits] online.git: 2 commits - common/Log.cpp kit/ForKit.cpp kit/Kit.cpp wsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Mon Jan 9 06:20:38 UTC 2017


 common/Log.cpp         |   10 ++++++++--
 kit/ForKit.cpp         |    2 +-
 kit/Kit.cpp            |    5 ++++-
 wsd/DocumentBroker.cpp |    6 +++++-
 4 files changed, 18 insertions(+), 5 deletions(-)

New commits:
commit b2160ee3a736fa57481280bdbb815c1315748440
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jan 8 12:22:21 2017 -0500

    wsd: improved logging
    
    Change-Id: I9c10803f451b6226c6a15d89acd4758c04042f28
    Reviewed-on: https://gerrit.libreoffice.org/32864
    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 115a2df..f0fe536 100644
--- a/kit/ForKit.cpp
+++ b/kit/ForKit.cpp
@@ -97,7 +97,7 @@ public:
             const auto count = std::stoi(tokens[1]);
             if (count > 0)
             {
-                LOG_INF("Spawning " << tokens[1] << ' ' << (count == 1 ? "child" : "children") << " per request.");
+                LOG_INF("Setting to spawn " << tokens[1] << " child" << (count == 1 ? "" : "ren") << " per request.");
                 ForkCounter = count;
             }
             else
diff --git a/kit/Kit.cpp b/kit/Kit.cpp
index e840210..cd15e77 100644
--- a/kit/Kit.cpp
+++ b/kit/Kit.cpp
@@ -1220,9 +1220,12 @@ private:
                 if (size == disconnect.size() &&
                     strncmp(data, disconnect.data(), disconnect.size()) == 0)
                 {
-                    LOG_DBG("Removing ChildSession " << sessionId);
+                    LOG_DBG("Removing ChildSession [" << sessionId << "].");
                     _oldSessionIds[session->getViewId()] = UserInfo({session->getViewUserId(), session->getViewUserName()});
                     _sessions.erase(it);
+                    const auto count = _sessions.size();
+                    LOG_DBG("Have " << count << " child" << (count == 1 ? "" : "ren") <<
+                            " after removing ChildSession [" << sessionId << "].");
 
                     // No longer needed, and allow session dtor to take it.
                     lock.unlock();
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index a4ea62a..35448fb 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -652,6 +652,9 @@ size_t DocumentBroker::removeSession(const std::string& id)
 
     try
     {
+        LOG_INF("Removing session [" << id << "] on docKey [" << _docKey <<
+                "]. Have " << _sessions.size() << " sessions.");
+
         Admin::instance().rmDoc(_docKey, id);
 
         auto it = _sessions.find(id);
@@ -672,7 +675,8 @@ size_t DocumentBroker::removeSession(const std::string& id)
         }
         else
         {
-            LOG_TRC("Session [" << id << "] not found to remove from docKey [" << _docKey << "]");
+            LOG_TRC("Session [" << id << "] not found to remove from docKey [" <<
+                    _docKey << "]. Have " << _sessions.size() << " sessions.");
         }
     }
     catch (const std::exception& ex)
commit fe9e95dfa3ed04c142110e88a071e63afadb7da7
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Sun Jan 8 12:21:14 2017 -0500

    wsd: log the time when initializing the logger
    
    Change-Id: I785c2a6a13dedbecf10a96a593f05e13980ea1e6
    Reviewed-on: https://gerrit.libreoffice.org/32863
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/common/Log.cpp b/common/Log.cpp
index c263975..3141abd 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -11,6 +11,7 @@
 
 #include <atomic>
 #include <cassert>
+#include <ctime>
 #include <iomanip>
 #include <sstream>
 #include <string>
@@ -154,8 +155,13 @@ namespace Log
 
         logger.setLevel(logLevel.empty() ? std::string("trace") : logLevel);
 
-        info("Initializing " + name);
-        info("Log level is [" + std::to_string(logger.getLevel()) + "].");
+        const std::time_t t = std::time(nullptr);
+        oss.str("");
+        oss.clear();
+        oss << "Initializing " << name << ". Local time: " << std::put_time(std::localtime(&t), "%c %Z")
+            << ". UTC: " << std::put_time(std::gmtime(&t), "%c %Z")
+            <<  ". Log level is [" << logger.getLevel() << "].";
+        info(oss.str());
     }
 
     Poco::Logger& logger()


More information about the Libreoffice-commits mailing list