[asterisk-scf-commits] asterisk-scf/release/logger.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Nov 24 16:50:01 CST 2010


branch "master" has been updated
       via  31e92c0ef55b8400b3e249274e08a0212b2ba997 (commit)
       via  e17f9ff765950f0aade918c391dda9aa04cf98fa (commit)
       via  62a90a5e6bad3c7f5006aeb3a0ce31d637daef62 (commit)
       via  a18787010c89a930bb29c6ced843561efdafac62 (commit)
       via  654e65ef2f217a127cbab5995e879fa44b83f8b5 (commit)
       via  c5add8e128b28e4d3102383fb603fec6c0300b96 (commit)
      from  b640beafa142b1becd1e2d305748199de88ce6dc (commit)

Summary of changes:
 client/config/logging-client.conf |    2 +-
 client/src/IceConfigurator.cpp    |    9 +++-
 client/src/IceLogger.cpp          |   79 +++++++++++++++++++++++--------------
 client/src/IceLogger.h            |    5 ++
 4 files changed, 62 insertions(+), 33 deletions(-)
 mode change 100755 => 100644 client/src/LogOut.h
 mode change 100755 => 100644 client/src/logger.h
 mode change 100755 => 100644 common/Level.h
 mode change 100755 => 100644 server/config/logging-server.conf
 mode change 100755 => 100644 server/src/CMakeLists.txt
 mode change 100755 => 100644 server/src/main.cpp
 mode change 100755 => 100644 server/test/CMakeLists.txt


- Log -----------------------------------------------------------------
commit 31e92c0ef55b8400b3e249274e08a0212b2ba997
Author: David M. Lee <dlee at digium.com>
Date:   Wed Nov 24 16:47:05 2010 -0600

    Use AMI to invoke locator.locate().
    
    When used as the client for the ServiceLocator itself, the call to
    locator.locate() deadlocks.  This happens because the communication
    thread is locked servicing the incoming IceStorm message, and cannot
    be acquired to send to the locator.  This would work if the locator
    we colocated, but AMD prevents that.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 6df347c..1056237 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -72,29 +72,39 @@ void ConfiguredIceLogger::updateLoggerFromServiceLocator()
 {
     if (mLocator)
     {
-        try
-        {
-            ServiceLocatorParamsPtr loggingServerParams =
-                new ServiceLocatorParams();
-            Ice::ObjectPrx serverObject = mLocator->locate(loggingServerParams);
-            if (serverObject)
-            {
-                LoggingServerPrx server = LoggingServerPrx::checkedCast(
-                    serverObject);
-                mLogger.setServer(server);
-            }
-        }
-        catch (Core::Discovery::V1::ServiceNotFound const &)
-        {
-            // couldn't find the service;
-            mLogger.setServer(LoggingServerPrx());
-        }
-        catch (std::exception const &e)
+        // we must use AMI to free this thread up for servicing requests
+        // if this client is used by the service locator itself, a
+        // synchronous call to locate would result in a deadlock
+        ServiceLocatorParamsPtr loggingServerParams =
+            new ServiceLocatorParams(LoggingServerCategory);
+        mLocator->begin_locate(loggingServerParams);
+    }
+}
+
+void ConfiguredIceLogger::locateFinished(const Ice::AsyncResultPtr &r)
+{
+    ServiceLocatorPrx locator = ServiceLocatorPrx::uncheckedCast(r->getProxy());
+    try
+    {
+        Ice::ObjectPrx serverObject = locator->end_locate(r);
+        if (serverObject)
         {
-            std::clog << "Failed to locate LoggerService: " << e.what() << '\n';
-            mLogger.setServer(LoggingServerPrx());
+            LoggingServerPrx server = LoggingServerPrx::checkedCast(
+                serverObject);
+            mLogger.setServer(server);
         }
     }
+    catch (Core::Discovery::V1::ServiceNotFound const &)
+    {
+        // couldn't find the service;
+        mLogger.setServer(LoggingServerPrx());
+    }
+    catch (std::exception const &e)
+    {
+        std::clog << "(Logger) Failed to locate LoggerService: " <<
+            e.what() << '\n';
+        mLogger.setServer(LoggingServerPrx());
+    }
 }
 
 void ConfiguredIceLogger::comparisonRegistered(std::string const &guid,
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index d8abf04..fc04983 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -74,6 +74,8 @@ public:
 private:
     IceLogger mLogger;
     Core::Discovery::V1::ServiceLocatorPrx mLocator;
+
+    void locateFinished(const Ice::AsyncResultPtr &r);
 };
 
 typedef IceUtil::Handle<ConfiguredIceLogger> ConfiguredIceLoggerPtr;

commit e17f9ff765950f0aade918c391dda9aa04cf98fa
Author: David M. Lee <dlee at digium.com>
Date:   Wed Nov 24 16:46:39 2010 -0600

    Prefix local messages with (Logger).

diff --git a/client/src/IceConfigurator.cpp b/client/src/IceConfigurator.cpp
index e7e5f60..53ad662 100644
--- a/client/src/IceConfigurator.cpp
+++ b/client/src/IceConfigurator.cpp
@@ -121,12 +121,17 @@ IceConfiguratorPtr AsteriskSCF::System::Logging::createIceConfigurator(
             adapter->activate();
             return r;
         }
+        else
+        {
+            std::clog << "(Logger) "
+                "IceStorm not available.  Cannot listen to config events.\n";
+        }
     }
     catch (std::exception const &e)
     {
-        std::clog << "Error registering with IceStorm: " << e.what() << '\n';
+        std::clog << "(Logger) Error registering with IceStorm: " <<
+            e.what() << '\n';
     }
 
-    std::clog << "IceStorm not available.  Cannot listen to config events.\n";
     return IceConfiguratorPtr();
 }
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 1288d2e..6df347c 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -38,11 +38,12 @@ void IceLogger::logs(std::string const &name, Level logLevel,
     }
     catch (std::exception const &e)
     {
-        std::clog << "Failed to contact LoggerServer: " << e.what() << '\n';
+        std::clog << "(Logger) Failed to contact LoggerServer: " <<
+            e.what() << '\n';
     }
     catch (...)
     {
-        std::clog << "Failed to contact LoggerServer\n";
+        std::clog << "(Logger) Failed to contact LoggerServer\n";
     }
 
     if (!logged)
@@ -157,7 +158,8 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
     }
     catch (std::exception const &e)
     {
-        std::clog << "Failed to contact LoggerServer: " << e.what() << '\n';
+        std::clog << "(Logger) Failed to contact LoggerServer: " <<
+            e.what() << '\n';
     }
 
     // ServiceLocator used AMD, which won't work with collocation optimization
@@ -169,7 +171,7 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
     // log to a LoggerServer because it can never find it.
     if (!locator)
     {
-        std::clog << "LocatorService.Proxy not set.  Cannot find "
+        std::clog << "(Logger) LocatorService.Proxy not set.  Cannot find "
                   << LoggingServerGuid << '\n';
     }
 
@@ -193,13 +195,14 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
         }
         catch (std::exception const &e)
         {
-            std::clog << "Failed to subscribe to " << Discovery::TOPIC << ": "
-                      << e.what() << '\n';
+            std::clog << "(Logger) Failed to subscribe to " <<
+                Discovery::TOPIC << ": " << e.what() << '\n';
         }
     }
     else
     {
-        std::clog << "TopicManager.Proxy not set.  Will not receive updates.\n";
+        std::clog << "(Logger) TopicManager.Proxy not set.  "
+            "Will not receive updates.\n";
     }
 
     return logger;

commit 62a90a5e6bad3c7f5006aeb3a0ce31d637daef62
Author: David M. Lee <dlee at digium.com>
Date:   Wed Nov 24 16:06:25 2010 -0600

    Improved no server message.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 2ebab57..1288d2e 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -42,13 +42,17 @@ void IceLogger::logs(std::string const &name, Level logLevel,
     }
     catch (...)
     {
-        std::clog << "Failed to contact LoggerServer";
+        std::clog << "Failed to contact LoggerServer\n";
     }
 
     if (!logged)
     {
-        std::clog << "(no server) " << name << ":" << logLevel << ":" << message
-                  << '\n';
+        if (!hasPrintedNoServerNotice) {
+            hasPrintedNoServerNotice = true;
+            std::clog <<
+                "!!! unable to log to server.  logging to stderr instead.\n";
+        }
+        std::clog << name << ":" << logLevel << ":" << message << '\n';
     }
 }
 
diff --git a/client/src/IceLogger.h b/client/src/IceLogger.h
index 49ea64e..d8abf04 100644
--- a/client/src/IceLogger.h
+++ b/client/src/IceLogger.h
@@ -27,6 +27,8 @@ namespace Logging
 class IceLogger : public LogOut
 {
 public:
+    IceLogger() : hasPrintedNoServerNotice(false) {}
+
     void logs(std::string const &name, Level logLevel,
         std::string const &message);
 
@@ -35,6 +37,7 @@ public:
 
 private:
     LoggingServerPrx mServer;
+    bool hasPrintedNoServerNotice;
 };
 
 /**

commit a18787010c89a930bb29c6ced843561efdafac62
Author: David M. Lee <dlee at digium.com>
Date:   Wed Nov 24 16:05:51 2010 -0600

    Disable collocation optimization for service locator proxy.

diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 84ff57f..2ebab57 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -156,8 +156,10 @@ ConfiguredIceLoggerPtr AsteriskSCF::System::Logging::createIceLogger(
         std::clog << "Failed to contact LoggerServer: " << e.what() << '\n';
     }
 
+    // ServiceLocator used AMD, which won't work with collocation optimization
     ServiceLocatorPrx locator = ServiceLocatorPrx::uncheckedCast(
-        communicator->propertyToProxy("LocatorService.Proxy"));
+        communicator->propertyToProxy("LocatorService.Proxy")
+            ->ice_collocationOptimized(false));
     // if the LocatorService.Proxy isn't set, we'll log a message, but proceed
     // on in ignorance.  we'll basically build an IceLogger that can never
     // log to a LoggerServer because it can never find it.

commit 654e65ef2f217a127cbab5995e879fa44b83f8b5
Author: David M. Lee <dlee at digium.com>
Date:   Wed Nov 24 16:07:48 2010 -0600

    Stupid execute bit.

diff --git a/client/src/LogOut.h b/client/src/LogOut.h
old mode 100755
new mode 100644
diff --git a/client/src/logger.h b/client/src/logger.h
old mode 100755
new mode 100644
diff --git a/common/Level.h b/common/Level.h
old mode 100755
new mode 100644
diff --git a/server/config/logging-server.conf b/server/config/logging-server.conf
old mode 100755
new mode 100644
diff --git a/server/src/CMakeLists.txt b/server/src/CMakeLists.txt
old mode 100755
new mode 100644
diff --git a/server/src/main.cpp b/server/src/main.cpp
old mode 100755
new mode 100644
diff --git a/server/test/CMakeLists.txt b/server/test/CMakeLists.txt
old mode 100755
new mode 100644

commit c5add8e128b28e4d3102383fb603fec6c0300b96
Author: David M. Lee <dlee at digium.com>
Date:   Tue Nov 16 22:47:07 2010 -0600

    Hydra -> AsteriskSCF

diff --git a/client/config/logging-client.conf b/client/config/logging-client.conf
index 0ae8e15..f940860 100644
--- a/client/config/logging-client.conf
+++ b/client/config/logging-client.conf
@@ -9,4 +9,4 @@ AsteriskSCF.LoggingClient.Endpoints=default
 LocatorService.Proxy=LocatorService:tcp -p 4411
 
 # A proxy to the IceStorm topic manager
-TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
+TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000

-----------------------------------------------------------------------


-- 
asterisk-scf/release/logger.git



More information about the asterisk-scf-commits mailing list