[Libreoffice-commits] online.git: 3 commits - loolwsd/Admin.cpp loolwsd/ChildProcessSession.cpp loolwsd/LOOLKit.cpp loolwsd/LOOLSession.cpp loolwsd/LOOLWSD.cpp loolwsd/MasterProcessSession.cpp loolwsd/QueueHandler.hpp loolwsd/Util.cpp

Tor Lillqvist tml at collabora.com
Mon Mar 7 16:36:42 UTC 2016


 loolwsd/Admin.cpp                |    4 ++--
 loolwsd/ChildProcessSession.cpp  |    5 ++---
 loolwsd/LOOLKit.cpp              |    8 ++++----
 loolwsd/LOOLSession.cpp          |    9 ++++-----
 loolwsd/LOOLWSD.cpp              |   16 ++++++++--------
 loolwsd/MasterProcessSession.cpp |    2 +-
 loolwsd/QueueHandler.hpp         |    4 ++--
 loolwsd/Util.cpp                 |    8 ++++----
 8 files changed, 27 insertions(+), 29 deletions(-)

New commits:
commit 9f67eecadd84420a5c4a27c041e7fdbe0ec0eecf
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 7 18:22:39 2016 +0200

    Improve exception logging
    
    Always try to identify *where* we caught the exception. It is not that
    useful to have half a dozen places that all just log "Exception:".

diff --git a/loolwsd/Admin.cpp b/loolwsd/Admin.cpp
index 2fa50ab..ff9c806 100644
--- a/loolwsd/Admin.cpp
+++ b/loolwsd/Admin.cpp
@@ -157,7 +157,7 @@ public:
         }
         catch (const WebSocketException& exc)
         {
-            Log::error("AdminRequestHandler::handleRequest(), WebSocketException: " + exc.message());
+            Log::error("AdminRequestHandler::handleRequest: WebSocketException: " + exc.message());
             switch (exc.code())
             {
             case WebSocket::WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION:
@@ -174,7 +174,7 @@ public:
         }
         catch (const std::exception& exc)
         {
-            Log::error(std::string("Exception: ") + exc.what());
+            Log::error(std::string("AdminRequestHandler::handleRequest: Exception: ") + exc.what());
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index fe77656..51f6790 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -222,15 +222,14 @@ public:
                 }
                 catch (const Exception& exc)
                 {
-                    Log::error() << "Error while handling callback [" << LOKitHelper::kitCallbackTypeToString(nType) << "]. "
+                    Log::error() << "CallbackWorker::run: Exception while handling callback [" << LOKitHelper::kitCallbackTypeToString(nType) << "]: "
                                  << exc.displayText()
                                  << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                                  << Log::end;
                 }
                 catch (const std::exception& exc)
                 {
-                    Log::error("Error while handling callback [" + LOKitHelper::kitCallbackTypeToString(nType) + "]. " +
-                               std::string("Exception: ") + exc.what());
+                    Log::error("CallbackWorker::run: Exception while handling callback [" + LOKitHelper::kitCallbackTypeToString(nType) + "]: " + exc.what());
                 }
             }
             else
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 3550279..44184da 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -271,17 +271,17 @@ public:
         }
         catch (const Exception& exc)
         {
-            Log::error() << "Error: " << exc.displayText()
+            Log::error() << "Connection::run: Exception: " << exc.displayText()
                          << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                          << Log::end;
         }
         catch (const std::exception& exc)
         {
-            Log::error(std::string("Exception: ") + exc.what());
+            Log::error(std::string("Connection::run: Exception: ") + exc.what());
         }
         catch (...)
         {
-            Log::error("Unexpected Exception.");
+            Log::error("Connection::run:: Unexpected exception");
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
@@ -358,7 +358,7 @@ public:
             }
             catch(Poco::Net::NetException& exc)
             {
-                Log::error() << "Error: " << exc.displayText()
+                Log::error() << "Document::~Document: NetException: " << exc.displayText()
                              << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                              << Log::end;
             }
diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp
index 433d9fd..c28bbcc 100644
--- a/loolwsd/LOOLSession.cpp
+++ b/loolwsd/LOOLSession.cpp
@@ -199,20 +199,19 @@ bool LOOLSession::handleInput(const char *buffer, int length)
     }
     catch (const Exception& exc)
     {
-        Log::error() << "Error while handling [" + getFirstLine(buffer, length) + "] in "
-                     << getName() << ". "
+        Log::error() << "LOOLSession::handleInput: Exception while handling [" + getFirstLine(buffer, length) + "] in "
+                     << getName() << ": "
                      << exc.displayText()
                      << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                      << Log::end;
     }
     catch (const std::exception& exc)
     {
-        Log::error("Error while handling [" + getFirstLine(buffer, length) + "]. " +
-                   std::string("Exception: ") + exc.what());
+        Log::error("LOOLSession::handleInput: Exception while handling [" + getFirstLine(buffer, length) + "]: " + exc.what());
     }
     catch (...)
     {
-        Log::error("Unexpected Exception.");
+        Log::error("LOOLSession::handleInput: Unexpected exception");
     }
 
     return false;
diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index ad5726b..dec4602 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -304,7 +304,7 @@ void SocketProcessor(std::shared_ptr<WebSocket> ws,
     }
     catch (const WebSocketException& exc)
     {
-        Log::error("RequestHandler::handleRequest(), WebSocketException: " + exc.message());
+        Log::error("SocketProcessor: WebSocketException: " + exc.message());
         switch (exc.code())
         {
         case WebSocket::WS_ERR_HANDSHAKE_UNSUPPORTED_VERSION:
@@ -430,7 +430,7 @@ private:
                 }
                 catch (const IOException& exc)
                 {
-                    Log::info() << "IOException: " << exc.message() << Log::end;
+                    Log::info() << "ClientRequestHandler::handlePostRequest: IOException: " << exc.message() << Log::end;
                     response.setStatus(HTTPResponse::HTTP_BAD_REQUEST);
                     response.send();
                 }
@@ -571,17 +571,17 @@ public:
         }
         catch (const Exception& exc)
         {
-            Log::error() << "Error: " << exc.displayText()
+            Log::error() << "ClientRequestHandler::handleRequest: Exception: " << exc.displayText()
                          << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                          << Log::end;
         }
         catch (const std::exception& exc)
         {
-            Log::error(std::string("Exception: ") + exc.what());
+            Log::error(std::string("ClientRequestHandler::handleRequest: Exception: ") + exc.what());
         }
         catch (...)
         {
-            Log::error("Unexpected Exception.");
+            Log::error("ClientRequestHandler::handleRequest: Unexpected exception");
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
@@ -621,17 +621,17 @@ public:
         }
         catch (const Exception& exc)
         {
-            Log::error() << "Error: " << exc.displayText()
+            Log::error() << "PrisonerRequestHandler::handleRequest: Exception: " << exc.displayText()
                          << (exc.nested() ? " (" + exc.nested()->displayText() + ")" : "")
                          << Log::end;
         }
         catch (const std::exception& exc)
         {
-            Log::error(std::string("Exception: ") + exc.what());
+            Log::error(std::string("PrisonerRequestHandler::handleRequest: Exception: ") + exc.what());
         }
         catch (...)
         {
-            Log::error("Unexpected Exception.");
+            Log::error("PrisonerRequestHandler::handleRequest: Unexpected exception");
         }
 
         Log::debug("Thread [" + thread_name + "] finished.");
diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp
index 7f32192..cb2b82c 100644
--- a/loolwsd/MasterProcessSession.cpp
+++ b/loolwsd/MasterProcessSession.cpp
@@ -52,7 +52,7 @@ MasterProcessSession::~MasterProcessSession()
     }
     catch (const std::exception& exc)
     {
-        Log::error(std::string("Exception: ") + exc.what());
+        Log::error(std::string("MasterProcessSession::~MasterProcessSession: Exception: ") + exc.what());
     }
 }
 
diff --git a/loolwsd/QueueHandler.hpp b/loolwsd/QueueHandler.hpp
index 35d5f7c..4f3d612 100644
--- a/loolwsd/QueueHandler.hpp
+++ b/loolwsd/QueueHandler.hpp
@@ -52,11 +52,11 @@ public:
         }
         catch (const std::exception& exc)
         {
-            Log::error(std::string("Exception: ") + exc.what());
+            Log::error(std::string("QueueHandler::run: Exception: ") + exc.what());
         }
         catch (...)
         {
-            Log::error("Unexpected Exception.");
+            Log::error("QueueHandler::run: Unexpected exception");
         }
 
         Log::debug("Thread [" + _name + "] finished.");
diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 0571618..92c8456 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -279,7 +279,7 @@ namespace Util
         }
         catch (const Poco::IOException& exc)
         {
-            Log::warn("IOException while socket shutdown: " + exc.message());
+            Log::warn("Util::shutdownWebSocket: IOException: " + exc.message());
         }
     }
 
@@ -541,7 +541,7 @@ namespace Util
         }
         catch(const Poco::Exception& exc)
         {
-            Log::warn("Exception: " + exc.message());
+            Log::warn("Util::requestTermination: Exception: " + exc.message());
         }
     }
 
commit 8fc4f1d95fb7527031779bcab328116f52ff304b
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 7 17:44:51 2016 +0200

    10 seconds is a bit short

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 74c3fe2..0571618 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -449,7 +449,7 @@ namespace Util
                          << "sudo gdb --pid=" << Poco::Process::id() << "\n or \n"
                          << "sudo gdb --q --n --ex 'thread apply all backtrace full' --batch --pid="
                          << Poco::Process::id() << "\n" << Log::end;
-            sleep(10);
+            sleep(30);
         }
 
         struct sigaction action;
commit d27e798e0fb38156fd6a31989c3c8763dddefa15
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Mar 7 17:44:11 2016 +0200

    It is not only a 'segfault' that is handled here

diff --git a/loolwsd/Util.cpp b/loolwsd/Util.cpp
index 4a7789c..74c3fe2 100644
--- a/loolwsd/Util.cpp
+++ b/loolwsd/Util.cpp
@@ -445,7 +445,7 @@ namespace Util
 
         if (std::getenv("LOOL_DEBUG"))
         {
-            Log::error() << "\nSegfault! Attach debugger with:\n"
+            Log::error() << "\nFatal signal! Attach debugger with:\n"
                          << "sudo gdb --pid=" << Poco::Process::id() << "\n or \n"
                          << "sudo gdb --q --n --ex 'thread apply all backtrace full' --batch --pid="
                          << Poco::Process::id() << "\n" << Log::end;


More information about the Libreoffice-commits mailing list