summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2009-11-03 01:01:11 +0100
committerJose <jose@zeroc.com>2009-11-03 01:01:11 +0100
commit1d5da5b2d464872a8e49c49b973db548413e3859 (patch)
tree3a2bc9bce115b1299e925fde93f6d6e1cd802857 /cpp/src
parentFixed bug 4346 - gcc 4.3.4 warnings (diff)
downloadice-1d5da5b2d464872a8e49c49b973db548413e3859.tar.bz2
ice-1d5da5b2d464872a8e49c49b973db548413e3859.tar.xz
ice-1d5da5b2d464872a8e49c49b973db548413e3859.zip
2589 - Bogus Ice.ProgramName value for IceBox service.
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/LoggerI.cpp11
-rw-r--r--cpp/src/Ice/LoggerI.h2
-rw-r--r--cpp/src/Ice/SysLoggerI.cpp6
-rw-r--r--cpp/src/Ice/SysLoggerI.h1
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp6
5 files changed, 23 insertions, 3 deletions
diff --git a/cpp/src/Ice/LoggerI.cpp b/cpp/src/Ice/LoggerI.cpp
index 634eb5c0c29..d270d2a3e4c 100644
--- a/cpp/src/Ice/LoggerI.cpp
+++ b/cpp/src/Ice/LoggerI.cpp
@@ -51,10 +51,11 @@ Ice::LoggerI::LoggerI(const string& prefix, const string& file)
if(!file.empty())
{
- _out.open(file.c_str(), fstream::out | fstream::app);
+ _file = file;
+ _out.open(_file.c_str(), fstream::out | fstream::app);
if(!_out.is_open())
{
- throw InitializationException(__FILE__, __LINE__, "FileLogger: cannot open " + file);
+ throw InitializationException(__FILE__, __LINE__, "FileLogger: cannot open " + _file);
}
}
}
@@ -99,6 +100,12 @@ Ice::LoggerI::error(const string& message)
write("!! " + IceUtil::Time::now().toDateTime() + " " + _prefix + "error: " + message, true);
}
+LoggerPtr
+Ice::LoggerI::cloneWithPrefix(const std::string& prefix)
+{
+ return new LoggerI(prefix, _file);
+}
+
void
Ice::LoggerI::write(const string& message, bool indent)
{
diff --git a/cpp/src/Ice/LoggerI.h b/cpp/src/Ice/LoggerI.h
index f3d849609b8..880922b5150 100644
--- a/cpp/src/Ice/LoggerI.h
+++ b/cpp/src/Ice/LoggerI.h
@@ -28,6 +28,7 @@ public:
virtual void trace(const std::string&, const std::string&);
virtual void warning(const std::string&);
virtual void error(const std::string&);
+ virtual LoggerPtr cloneWithPrefix(const std::string&);
private:
@@ -35,6 +36,7 @@ private:
std::string _prefix;
std::fstream _out;
+ std::string _file;
};
typedef IceUtil::Handle<LoggerI> LoggerIPtr;
diff --git a/cpp/src/Ice/SysLoggerI.cpp b/cpp/src/Ice/SysLoggerI.cpp
index b3288e9f95d..83feda8f981 100644
--- a/cpp/src/Ice/SysLoggerI.cpp
+++ b/cpp/src/Ice/SysLoggerI.cpp
@@ -54,3 +54,9 @@ Ice::SysLoggerI::error(const string& message)
IceUtil::Mutex::Lock sync(*this);
syslog(LOG_ERR, "%s", message.c_str());
}
+
+Ice::LoggerPtr
+Ice::SysLoggerI::cloneWithPrefix(const string& prefix)
+{
+ return new SysLoggerI(prefix);
+}
diff --git a/cpp/src/Ice/SysLoggerI.h b/cpp/src/Ice/SysLoggerI.h
index 86b71341c35..e6d7bc36e93 100644
--- a/cpp/src/Ice/SysLoggerI.h
+++ b/cpp/src/Ice/SysLoggerI.h
@@ -27,6 +27,7 @@ public:
virtual void trace(const std::string&, const std::string&);
virtual void warning(const std::string&);
virtual void error(const std::string&);
+ virtual LoggerPtr cloneWithPrefix(const std::string&);
};
}
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 24e8a723e99..e8a71aa8645 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -128,7 +128,6 @@ IceBox::ServiceManagerI::ServiceManagerI(CommunicatorPtr communicator, int& argc
_traceServiceObserver(0)
{
_logger = _communicator->getLogger();
-
_traceServiceObserver = _communicator->getProperties()->getPropertyAsInt("IceBox.Trace.ServiceObserver");
for(int i = 1; i < argc; i++)
@@ -655,6 +654,11 @@ IceBox::ServiceManagerI::start(const string& service, const string& entryPoint,
}
//
+ // Clone the logger to assing a new prefix.
+ //
+ initData.logger = _logger->cloneWithPrefix(initData.properties->getProperty("Ice.ProgramName"));
+
+ //
// Remaining command line options are passed to the communicator. This is
// necessary for Ice plug-in properties (e.g.: IceSSL).
//