diff options
author | Bernard Normier <bernard@zeroc.com> | 2014-08-14 16:38:21 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2014-08-14 16:38:21 -0400 |
commit | 18748d529095d3ab86e3dc42abfd2b5f4946f9a7 (patch) | |
tree | 1f343c0790d98e7fbcff50ad94ea5c1e272b2d4f /cpp/src/IceBox/ServiceManagerI.cpp | |
parent | Fixed ice_invocationTimout usage in IceDiscovery hello demos (diff) | |
download | ice-18748d529095d3ab86e3dc42abfd2b5f4946f9a7.tar.bz2 ice-18748d529095d3ab86e3dc42abfd2b5f4946f9a7.tar.xz ice-18748d529095d3ab86e3dc42abfd2b5f4946f9a7.zip |
Initial merge for ICE-2400:
- added new Logger admin facet (C++ only)
- this Logger facet allows remote application to retrieve the Ice log file, including recently logged events, with optional filters
- this logger facet also allows remote applications to attach RemoteLogger objects to get new logs as they are generated
- added new "show log" feature to icegridadmin, to retrieve Ice log file of Ice server (not yet implemented for IceGrid registry and node)
Diffstat (limited to 'cpp/src/IceBox/ServiceManagerI.cpp')
-rw-r--r-- | cpp/src/IceBox/ServiceManagerI.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index d1883c77537..433985d971a 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -17,6 +17,7 @@ #include <Ice/PropertiesAdminI.h> #include <Ice/MetricsAdminI.h> #include <Ice/InstrumentationI.h> +#include <Ice/LoggerAdminI.h> #include <IceBox/ServiceManagerI.h> using namespace Ice; @@ -597,6 +598,10 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, #endif ) { + // + // When _logger is a LoggerAdminLogger, cloneWithPrefix returns a clone of the + // underlying local logger, not of the LoggerAdminLogger itself + // initData.logger = _logger->cloneWithPrefix(initData.properties->getProperty("Ice.ProgramName")); } @@ -611,12 +616,38 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, } // + // If the Logger is enabled on the IceBox communicator, we tell the service + // to create a LoggerAdmin's Logger, by setting the property Ice.Admin.Logger + // + if(_communicator->findAdminFacet("Logger") != 0) + { + if(initData.properties->getPropertyWithDefault("Ice.Admin.Logger", "Logger") == "Logger") + { + initData.properties->setProperty("Ice.Admin.Logger", string("IceBox.Service.") + service + ".Logger"); + } + } + + // // Remaining command line options are passed to the communicator. This is // necessary for Ice plug-in properties (e.g.: IceSSL). // info.communicator = initialize(info.args, initData); communicator = info.communicator; + if(_communicator->findAdminFacet("Logger") != 0) + { + Ice::LoggerAdminLoggerPtr logger = Ice::LoggerAdminLoggerPtr::dynamicCast(communicator->getLogger()); + assert(logger != 0); // a plugin reset Ice.Admin.Logger to its default?? + if(logger != 0) + { + // + // We add this admin facet to the IceBox main communicator, even though the associated logger + // "works" for the service's communicator + // + logger->addAdminFacet(_communicator); + } + } + // // Ensure the metrics admin plugin uses the same property set as the // communicator. This is necessary to correctly deal with runtime |