[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
Tue Sep 20 13:41:33 CDT 2011
branch "master" has been updated
via 8b3d9fc03b820e35cc859a05fbd246b930ce6237 (commit)
from cc3eee6c90fcb07de28d2e40d25d491f9371ec18 (commit)
Summary of changes:
client/src/IceLogger.cpp | 9 +++++++++
include/AsteriskSCF/Logger/IceLogger.h | 3 ++-
server/src/main.cpp | 20 ++++++++++++++++++--
.../LoggingService/LoggingConfigurationIf.ice | 5 +++++
4 files changed, 34 insertions(+), 3 deletions(-)
- Log -----------------------------------------------------------------
commit 8b3d9fc03b820e35cc859a05fbd246b930ce6237
Author: Ken Hunt <ken.hunt at digium.com>
Date: Tue Sep 20 13:39:56 2011 -0500
Added some cleanup so that logger clients don't leave user thinking the logging service is never found.
Also registers the config interface to the service locator. (Testing of config always used hard-coded proxy before. Tests still need updating to use service locator.)
diff --git a/client/src/IceLogger.cpp b/client/src/IceLogger.cpp
index 0b2d50f..87d85ae 100644
--- a/client/src/IceLogger.cpp
+++ b/client/src/IceLogger.cpp
@@ -71,6 +71,15 @@ void IceLogger::logs(const std::string& name, Level logLevel,
}
std::clog << message << '\n';
}
+ else
+ {
+ if (mHasPrintedNoServerNotice && !mHasPrintedServiceFoundNotice)
+ {
+ mHasPrintedServiceFoundNotice = true;
+ std::clog <<
+ "Logging server found. No longer logging to stderr.\n";
+ }
+ }
}
void IceLogger::setComponentInfo(const std::string& componentCategory,
diff --git a/include/AsteriskSCF/Logger/IceLogger.h b/include/AsteriskSCF/Logger/IceLogger.h
index 8f3c012..dbac457 100644
--- a/include/AsteriskSCF/Logger/IceLogger.h
+++ b/include/AsteriskSCF/Logger/IceLogger.h
@@ -27,7 +27,7 @@ namespace Logging
class IceLogger : public LogOut
{
public:
- IceLogger() : mHasPrintedNoServerNotice(false) {}
+ IceLogger() : mHasPrintedNoServerNotice(false), mHasPrintedServiceFoundNotice(false) {}
void logs(const std::string& name, Level logLevel,
const std::string& message);
@@ -40,6 +40,7 @@ public:
private:
LoggingServerPrx mServer;
bool mHasPrintedNoServerNotice;
+ bool mHasPrintedServiceFoundNotice;
std::string mComponentCategory;
std::string mComponentServiceName;
std::string mComponentId;
diff --git a/server/src/main.cpp b/server/src/main.cpp
index 72edb51..18bf604 100644
--- a/server/src/main.cpp
+++ b/server/src/main.cpp
@@ -44,7 +44,9 @@ protected:
private:
Ice::ObjectAdapterPtr mAdapter;
ServiceManagementPrx mServiceManagement;
+ ServiceManagementPrx mConfigManagement;
ConfigurationServicePtr mConfigurationService;
+ ConfigurationServicePrx mConfigurationServicePrx;
std::string mName;
void registerWithServiceLocator(const Ice::CommunicatorPtr& communicator,
@@ -67,18 +69,31 @@ void LoggingService::registerWithServiceLocator(
locatorServiceProxyStr);
std::string serviceName = communicator->getProperties()->getPropertyWithDefault(
"LoggerServer.ServiceName", "default");
+
if (!locatorManagementProxyString.empty())
{
ServiceLocatorManagementPrx management =
ServiceLocatorManagementPrx::checkedCast(
communicator->stringToProxy(locatorManagementProxyString));
+
mServiceManagement = management->addService(serverProxy,
- LoggingServerGuid);
+ mName + "." + LoggingServerGuid);
ServiceLocatorParamsPtr params(new ServiceLocatorParams);
params->category = LoggingServerCategory;
params->service = serviceName;
+ params->id = mName;
mServiceManagement->addLocatorParams(params, "");
+
+ // Do the same for the configuration interface.
+ mConfigManagement = management->addService(serverProxy,
+ IceUtil::generateUUID());
+
+ ServiceLocatorParamsPtr configParams(new ServiceLocatorParams);
+ configParams->category = AsteriskSCF::Configuration::LoggingService::V1::ConfigurationDiscoveryCategory;
+ configParams->service = serviceName;
+ configParams->id = mName;
+ mConfigManagement->addLocatorParams(configParams, "");
}
else
{
@@ -176,7 +191,8 @@ void LoggingService::start(const std::string& name,
mAdapter->addWithUUID(server));
mConfigurationService = new LoggerConfigurationService(server);
- mAdapter->add(mConfigurationService, communicator->stringToIdentity(ConfigurationServiceId));
+ mConfigurationServicePrx = ConfigurationServicePrx::uncheckedCast(mAdapter->add(mConfigurationService,
+ communicator->stringToIdentity(ConfigurationServiceId)));
mAdapter->activate();
diff --git a/slice/AsteriskSCF/Configuration/LoggingService/LoggingConfigurationIf.ice b/slice/AsteriskSCF/Configuration/LoggingService/LoggingConfigurationIf.ice
index 049a88e..955c770 100644
--- a/slice/AsteriskSCF/Configuration/LoggingService/LoggingConfigurationIf.ice
+++ b/slice/AsteriskSCF/Configuration/LoggingService/LoggingConfigurationIf.ice
@@ -32,6 +32,11 @@ module V1
{
/**
+ * Service locator category for finding the configuration service
+ */
+ const string ConfigurationDiscoveryCategory = "LoggingServiceConfiguration";
+
+ /**
* Local visitor class for visiting Logger configuration groups
*/
local class LoggerConfigurationGroupVisitor extends AsteriskSCF::System::Configuration::V1::ConfigurationGroupVisitor
-----------------------------------------------------------------------
--
asterisk-scf/release/logger.git
More information about the asterisk-scf-commits
mailing list