[asterisk-scf-commits] asterisk-scf/integration/routing.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Tue Oct 5 12:43:53 CDT 2010
branch "master" has been updated
via f132a03ad0104a92fc0e9454219c7fecae874367 (commit)
from 6ff942dd9bd325b628c357a5dfb281138b1c16d8 (commit)
Summary of changes:
.gitmodules | 3 ++
CMakeLists.txt | 3 ++
cmake | 2 +-
config/basicrouting.config | 2 +-
config/icestorm.config | 33 ----------------------------
logger | 1 +
slice | 2 +-
src/BasicRoutingServiceApp.cpp | 39 ++++++++++++++++++++++-----------
src/CMakeLists.txt | 7 ++++++
src/EndpointRegistry.cpp | 31 ++++++++++++++-------------
src/LuaScriptProcessor.cpp | 14 ++++++++---
src/RoutingServiceEventPublisher.cpp | 18 ++++++++++-----
src/SessionRouter.cpp | 11 +++++++-
13 files changed, 90 insertions(+), 76 deletions(-)
delete mode 100644 config/icestorm.config
create mode 160000 logger
- Log -----------------------------------------------------------------
commit f132a03ad0104a92fc0e9454219c7fecae874367
Author: David M. Lee <dlee at digium.com>
Date: Tue Oct 5 12:43:24 2010 -0500
Logger integration
diff --git a/.gitmodules b/.gitmodules
index e2b290b..6b980ad 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "cmake"]
path = cmake
url = ../../release/cmake
+[submodule "logger"]
+ path = logger
+ url = git at git.asterisk.org:asterisk-scf/integration/logger
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2d15f0..abde640 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,9 @@ if(NOT integrated_build STREQUAL "true")
# Take care of slice definitions
add_subdirectory(slice)
+ # logger is integrated into our build
+ set(integrated_build true)
+ add_subdirectory(logger)
endif()
# Include the subdirectory information. This is separate so that
diff --git a/cmake b/cmake
index 364040a..e9cf9f2 160000
--- a/cmake
+++ b/cmake
@@ -1 +1 @@
-Subproject commit 364040aa2e2252eb07d896dc98eee1d2362f56e9
+Subproject commit e9cf9f2e6dd03fe7bc39c363d72812aceed28367
diff --git a/config/basicrouting.config b/config/basicrouting.config
index c2bd6c9..d4a2594 100644
--- a/config/basicrouting.config
+++ b/config/basicrouting.config
@@ -14,7 +14,7 @@ LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422
LocatorService.Proxy=LocatorService:tcp -p 4411
# Endpoints for Icestorm events
-TopicManager.Proxy=IceStorm/TopicManager:default -p 10000
+TopicManager.Proxy=HydraIceStorm/TopicManager:default -p 10000
# Category for the bridge service
BridgeManager.ServiceLocatorId=BridgeService
diff --git a/config/icestorm.config b/config/icestorm.config
deleted file mode 100644
index c6768e1..0000000
--- a/config/icestorm.config
+++ /dev/null
@@ -1,33 +0,0 @@
-# This is a configuration file used in conjunction with the service discovery test driver
-
-IceBox.Service.IceStorm=IceStormService,34:createIceStorm --Ice.Config=icestorm.config
-
-IceStorm.InstanceName=IceStorm
-
-IceStorm.Transient=1
-
-#
-# This property defines the endpoints on which the IceStorm
-# TopicManager listens.
-#
-IceStorm.TopicManager.Endpoints=default -p 10000
-
-#
-# This property defines the endpoints on which the topic
-# publisher objects listen. If you want to federate
-# IceStorm instances this must run on a fixed port (or use
-# IceGrid).
-#
-IceStorm.Publish.Endpoints=tcp -p 10001:udp -p 10001
-
-#
-# TopicManager Tracing
-#
-# 0 = no tracing
-# 1 = trace topic creation, subscription, unsubscription
-# 2 = like 1, but with more detailed subscription information
-#
-IceStorm.Trace.TopicManager=2
-
-#
-IceStorm.Flush.Timeout=2000
diff --git a/logger b/logger
new file mode 160000
index 0000000..0cc0c02
--- /dev/null
+++ b/logger
@@ -0,0 +1 @@
+Subproject commit 0cc0c02a16e404b94d54c8cb6736dee14a671352
diff --git a/slice b/slice
index df22de4..0c62939 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit df22de4cdfa237ab7cbabbc8af895de73f554a9a
+Subproject commit 0c629393e2f05dc0ed43bcc6305880949df36289
diff --git a/src/BasicRoutingServiceApp.cpp b/src/BasicRoutingServiceApp.cpp
index a5f42c7..c918e29 100644
--- a/src/BasicRoutingServiceApp.cpp
+++ b/src/BasicRoutingServiceApp.cpp
@@ -22,6 +22,8 @@
#include "EndpointRegistry.h"
#include "RoutingAdmin.h"
#include "SessionRouter.h"
+#include "IceLogger.h"
+#include "logger.h"
using namespace std;
using namespace AsteriskSCF::BasicRoutingService;
@@ -30,6 +32,12 @@ using namespace AsteriskSCF::Core;
using namespace AsteriskSCF::Core::Routing::V1;
using namespace AsteriskSCF::Core::Discovery::V1;
using namespace AsteriskSCF::System::Component::V1;
+using namespace AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
namespace AsteriskSCF
{
@@ -110,13 +118,13 @@ public: // Implementation details are visible to this file's classes.
}
catch(const Ice::Exception &e)
{
- cout << "Exception locating " << bridgeId << ": " << e.what() << endl;
+ lg(Error) << "Exception locating " << bridgeId << ": " << e.what();
return;
}
if (mBridgeManager == 0)
{
- cout << "Unable to locate " << bridgeId << endl;
+ lg(Error) << "Unable to locate " << bridgeId;
}
}
@@ -216,11 +224,11 @@ private:
*/
void BasicRoutingServiceApp::interruptCallback(int val)
{
- cout << "Exiting..." << endl;
- mDone = true;
- // Remove our interfaces from the service locator.
- deregisterFromServiceLocator();
- _exit(EXIT_SUCCESS);
+ lg(Info) << "Exiting...";
+ mDone = true;
+ // Remove our interfaces from the service locator.
+ deregisterFromServiceLocator();
+ _exit(EXIT_SUCCESS);
}
/**
@@ -250,7 +258,7 @@ void BasicRoutingServiceApp::registerWithServiceLocator()
if (mServiceLocatorManagement == 0)
{
- cout << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
+ lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected.";
return;
}
@@ -289,7 +297,7 @@ void BasicRoutingServiceApp::registerWithServiceLocator()
}
catch(...)
{
- cout << "Major problems in " << mAppName << " registerWithServiceLocator()" << endl;
+ lg(Error) << "Major problems in " << mAppName << " registerWithServiceLocator()";
}
}
@@ -308,7 +316,7 @@ void BasicRoutingServiceApp::deregisterFromServiceLocator()
}
catch(...)
{
- cout << "Had trouble in deregisterFromServiceLocator()." << endl;
+ lg(Error) << "Had trouble in deregisterFromServiceLocator().";
}
}
@@ -330,6 +338,11 @@ void BasicRoutingServiceApp::initialize(const std::string appName)
// Create the adapter.
mDataModelInstance.mAdapter = communicator()->createObjectAdapter("BasicRoutingServiceAdapter");
+ // setup the logger
+ ConfiguredIceLoggerPtr mIceLogger = createIceLogger(
+ mDataModelInstance.mAdapter);
+ getLoggerFactory().setLogOutput(mIceLogger->getLogger());
+
// Create and configure the EndpointRegistry.
mDataModelInstance.mEndpointRegistry = new EndpointRegistry();
boost::shared_ptr<ScriptProcessor> scriptProcesor(new LuaScriptProcessor());
@@ -354,17 +367,17 @@ void BasicRoutingServiceApp::initialize(const std::string appName)
mDataModelInstance.mAdapter->activate();
// Get a proxy to the interface for the Service Locator.
- mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
+ mDataModelInstance.mServiceLocator = ServiceLocatorPrx::checkedCast(communicator()->propertyToProxy("LocatorService.Proxy"));
}
catch(const Ice::Exception &exception)
{
- cout << "Major problems in " << mAppName << " initialization(): " << exception.what() << endl;
+ lg(Error) << "Major problems in " << mAppName << " initialization(): " << exception.what();
}
mDataModelInstance.locateBridgeManager();
if (mDataModelInstance.mBridgeManager == 0)
{
- cout << "Probabaly safe to ignore ServiceNotFound during startup. Will attempt to locate Bridge Service again when it is needed." << endl;
+ lg(Debug) << "Probabaly safe to ignore ServiceNotFound during startup. Will attempt to locate Bridge Service again when it is needed.";
}
}
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 245452e..8fa9180 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -25,7 +25,14 @@ hydra_component_add_file(BasicRoutingService RoutingServiceEventPublisher.h)
hydra_component_add_ice_libraries(BasicRoutingService IceStorm)
hydra_component_add_boost_libraries(BasicRoutingService thread core regex)
+if(NOT logger_dir)
+ message(FATAL_ERROR "The logger directory could not be found ${logger_dir}")
+endif()
+include_directories(${logger_dir}/common)
+include_directories(${logger_dir}/client/src)
+
hydra_component_build_standalone(BasicRoutingService)
target_link_libraries(BasicRoutingService ${LUA_LIBRARIES})
+target_link_libraries(BasicRoutingService logging-client)
hydra_component_install(BasicRoutingService RUNTIME bin "Basic Routing Service" Core)
diff --git a/src/EndpointRegistry.cpp b/src/EndpointRegistry.cpp
index ebe6466..a84ff32 100644
--- a/src/EndpointRegistry.cpp
+++ b/src/EndpointRegistry.cpp
@@ -11,10 +11,17 @@
#include "RoutingServiceEventPublisher.h"
#include "EndpointRegistry.h"
#include "ScriptProcessor.h"
+#include "logger.h"
using namespace ::AsteriskSCF::Core::Routing::V1;
+using namespace ::AsteriskSCF::System::Logging;
using namespace ::std;
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
+
namespace AsteriskSCF
{
namespace BasicRoutingService
@@ -88,8 +95,7 @@ void EndpointRegistry::addEndpointLocator(const ::std::string& locatorId,
if (existing != mImpl->mEndpointLocatorMap.end())
{
mImpl->mEndpointLocatorMap.erase(existing);
- // TBD... Logging!
- cout << "Received request to add endpoint with id " << locatorId << " which already exists. Replacing with new proxy." << endl;
+ lg(Info) << "Received request to add endpoint with id " << locatorId << " which already exists. Replacing with new proxy.";
}
RegisteredLocator newLocator(locator, regexList);
@@ -99,8 +105,7 @@ void EndpointRegistry::addEndpointLocator(const ::std::string& locatorId,
}
catch (...)
{
- // TBD... Logging!
- cout << "Exception adding EndpointLocator." << endl;
+ lg(Error) << "Exception adding EndpointLocator.";
mImpl->mEventPublisher.sendAddEndpointLocatorEvent(locatorId, regexList, Event::FAILURE);
return;
}
@@ -117,8 +122,7 @@ void EndpointRegistry::removeEndpointLocator(const ::std::string& locatorId, con
EndpointLocatorMapIterator existing = mImpl->mEndpointLocatorMap.find(locatorId);
if (existing == mImpl->mEndpointLocatorMap.end())
{
- // TBD... Logging...
- cerr << "Received request to remove Endpoint Locator not currently registered. Id = " << locatorId << endl;
+ lg(Warning) << "Received request to remove Endpoint Locator not currently registered. Id = " << locatorId;
mImpl->mEventPublisher.sendRemoveEndpointLocatorEvent(locatorId, Event::FAILURE);
return;
@@ -128,13 +132,12 @@ void EndpointRegistry::removeEndpointLocator(const ::std::string& locatorId, con
mImpl->mEndpointLocatorMap.erase(locatorId);
mImpl->mEventPublisher.sendRemoveEndpointLocatorEvent(locatorId, Event::SUCCESS);
- cout << "Removed Endpoint Locator with Id = " << locatorId << endl;
+ lg(Info) << "Removed Endpoint Locator with Id = " << locatorId;
}
catch(const std::exception &e)
{
mImpl->mEventPublisher.sendRemoveEndpointLocatorEvent(locatorId, Event::FAILURE);
- // TBD... Logging!
- cout << e.what() << endl;
+ lg(Error) << e.what();
}
}
@@ -165,9 +168,8 @@ void EndpointRegistry::setEndpointLocatorDestinationIds(const ::std::string& loc
catch(const std::exception &e)
{
mImpl->mEventPublisher.sendSetEndpointLocatorDestinationIdsEvent(locatorId, regExList, Event::FAILURE);
- // TBD... Logging!
- cout << "Exception modifying the destination specifications for EndpointLocator " << locatorId << endl;
- cout << " - " << e.what() << endl;
+ lg(Error) << "Exception modifying the destination specifications for EndpointLocator " << locatorId;
+ lg(Error) << " - " << e.what();
}
}
@@ -184,8 +186,7 @@ void EndpointRegistry::setEndpointLocatorDestinationIds(const ::std::string& loc
if (!mImpl->mScriptProcessor->confirmLookup(destination, modifiedDestination))
{
mImpl->mEventPublisher.sendLookupEvent(destination, Event::FAILURE);
- // TBD.. logging
- cout << "lookup(): denied by confirmLookup() script." << endl;
+ lg(Error) << "lookup(): denied by confirmLookup() script.";
return endpoints;
}
@@ -204,7 +205,7 @@ void EndpointRegistry::setEndpointLocatorDestinationIds(const ::std::string& loc
}
catch (const IceUtil::Exception &e)
{
- cout << "Exception calling registered EndpointLocator: " << e.what() << endl;
+ lg(Error) << "Exception calling registered EndpointLocator: " << e.what();
}
break;
}
diff --git a/src/LuaScriptProcessor.cpp b/src/LuaScriptProcessor.cpp
index 9e866bc..4cc19cc 100644
--- a/src/LuaScriptProcessor.cpp
+++ b/src/LuaScriptProcessor.cpp
@@ -11,10 +11,17 @@
#include <boost/thread/shared_mutex.hpp>
#include "LuaScriptProcessor.h"
+#include "logger.h"
using namespace ::AsteriskSCF::Core::Endpoint::V1;
+using namespace ::AsteriskSCF::System::Logging;
using namespace ::std;
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
+
namespace AsteriskSCF
{
namespace BasicRoutingService
@@ -57,7 +64,7 @@ public:
// Load script
if (luaL_dofile(mLuaState, "routing.lua"))
{
- cout << lua_tostring(mLuaState, -1) << std::endl;
+ lg(Info) << lua_tostring(mLuaState, -1);
return ;
}
@@ -124,7 +131,7 @@ public:
catch (...)
{
// TBD... Most likely a script error of some type.
- cout << "Lua Script error in call to lookup()." << endl;
+ lg(Error) << "Lua Script error in call to lookup().";
}
}
@@ -161,8 +168,7 @@ public:
}
catch (...)
{
- // TBD... Most likely a script error of some type.
- cout << "Lua Script error in call to confirmLookup()." << endl;
+ lg(Error) << "Lua Script error in call to confirmLookup().";
}
return true;
}
diff --git a/src/RoutingServiceEventPublisher.cpp b/src/RoutingServiceEventPublisher.cpp
index 71873da..bf865bb 100644
--- a/src/RoutingServiceEventPublisher.cpp
+++ b/src/RoutingServiceEventPublisher.cpp
@@ -10,9 +10,16 @@
#include "BasicRoutingServiceDataModel.h"
#include "RoutingServiceEventPublisher.h"
+#include "logger.h"
using namespace ::std;
using namespace ::AsteriskSCF::Core::Routing::V1;
+using namespace ::AsteriskSCF::System::Logging;
+
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
namespace AsteriskSCF
{
@@ -44,13 +51,13 @@ public:
if(!topicManager)
{
- cerr << "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?" << endl;
- return;
+ lg(Error) << "Invalid proxy to IceStorm. Missing config for TopicManager.Proxy?";
+ return;
}
}
catch(const IceUtil::Exception&)
{
- cerr << "Can't get IceStorm TopicManager. Check config, and make sure IceStorm is running." << endl;
+ lg(Error) << "Can't get IceStorm TopicManager. Check config, and make sure IceStorm is running.";
return;
}
@@ -68,7 +75,7 @@ public:
catch(const IceStorm::TopicExists&)
{
// Topic didn't exist so I tried to create it. But now it exists. Someone else beat me to the punch.
- cerr << "Possible race condition creating IceStorm topic " << Event::TopicId << ". Suggest Restart!" << endl;
+ lg(Error) << "Possible race condition creating IceStorm topic " << Event::TopicId << ". Suggest Restart!";
return;
}
}
@@ -94,8 +101,7 @@ public:
if (!mInitialized)
{
- // TBD...Logging
- cout << "Routing Service event publishing can't locate IceStorm." << endl;
+ lg(Error) << "Routing Service event publishing can't locate IceStorm.";
}
return mInitialized;
diff --git a/src/SessionRouter.cpp b/src/SessionRouter.cpp
index 3b08871..9a91682 100644
--- a/src/SessionRouter.cpp
+++ b/src/SessionRouter.cpp
@@ -11,15 +11,22 @@
#include "BasicRoutingServiceDataModel.h"
#include "RoutingIf.h"
#include "EndpointIf.h"
+#include "logger.h"
using namespace ::AsteriskSCF::Core::Routing::V1;
using namespace ::AsteriskSCF::Core::Endpoint::V1;
+using namespace ::AsteriskSCF::System::Logging;
using namespace ::AsteriskSCF::SessionCommunications::V1;
using namespace ::AsteriskSCF::SessionCommunications::Bridging::V1;
using namespace ::AsteriskSCF::BasicRoutingService;
using namespace ::std;
+namespace
+{
+Logger &lg = getLoggerFactory().getLogger("AsteriskSCF.BasicRoutingService");
+}
+
/**
* TBD... This code should be refactored for AMD and use AMI on outgoing calls.
*/
@@ -179,7 +186,7 @@ public:
}
catch(const Ice::Exception &e)
{
- cout << "Unable to create listener. " << e.what() << endl;
+ lg(Error) << "Unable to create listener. " << e.what();
return 0;
}
}
@@ -253,7 +260,7 @@ void SessionRouter::routeSession(const ::AsteriskSCF::SessionCommunications::V1:
}
catch(const Ice::Exception &exception)
{
- cout << "Unable to create sessionEndpoint for " << destination << ". " << exception.what() << endl;
+ lg(Error) << "Unable to create sessionEndpoint for " << destination << ". " << exception.what();
// We may be able to reach SOME of the endpoints.
}
}
-----------------------------------------------------------------------
--
asterisk-scf/integration/routing.git
More information about the asterisk-scf-commits
mailing list