summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Service.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-01-14 16:05:38 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-01-14 16:05:38 +0100
commitc12bd40de94f50d0a19a89f815e7d90b37420fcb (patch)
tree58f33bd29caf42fbc02fe63c5a19559f2eba27db /cpp/src/Ice/Service.cpp
parentBug 2556- add expect script for transform demo (diff)
downloadice-c12bd40de94f50d0a19a89f815e7d90b37420fcb.tar.bz2
ice-c12bd40de94f50d0a19a89f815e7d90b37420fcb.tar.xz
ice-c12bd40de94f50d0a19a89f815e7d90b37420fcb.zip
Fixed bug 2637, 2279 & 2057
Diffstat (limited to 'cpp/src/Ice/Service.cpp')
-rwxr-xr-xcpp/src/Ice/Service.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp
index 45a88f9478b..ed6b2c98a1d 100755
--- a/cpp/src/Ice/Service.cpp
+++ b/cpp/src/Ice/Service.cpp
@@ -383,14 +383,15 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa
{
_name = argv[0];
-#ifdef _WIN32
-
//
- // On Windows, we parse the properties here to extract Ice.EventLog.Source
+ // We parse the properties here to extract Ice.ProgramName and
+ // Ice.EventLog.Source on Windows.
//
InitializationData initData = initializationData;
initData.properties = createProperties(argc, argv, initData.properties, initData.stringConverter);
+#ifdef _WIN32
+
//
// First check for the --service option.
//
@@ -410,14 +411,13 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa
name = argv[idx + 1];
//
- // If the process logger the default logger then we use
+ // If the process logger is the default logger then we use
// our own logger.
//
_logger = getProcessLogger();
if(LoggerIPtr::dynamicCast(_logger))
{
- string eventLogSource = initData.properties->
- getPropertyWithDefault("Ice.EventLog.Source", name);
+ string eventLogSource = initData.properties->getPropertyWithDefault("Ice.EventLog.Source", name);
_logger = new SMEventLoggerI(eventLogSource);
setProcessLogger(_logger);
}
@@ -595,8 +595,6 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa
// Check for --daemon, --noclose, --nochdir and --pidfile.
//
- const InitializationData& initData = initializationData;
-
bool daemonize = false;
bool closeFiles = true;
bool changeDirectory = true;
@@ -676,6 +674,21 @@ Ice::Service::main(int& argc, char* argv[], const InitializationData& initializa
}
#endif
+ //
+ // If no logger has been set yet, we set it to the process logger. If the
+ // process logger is the default logger, we change it to a logger which is
+ // using the program name for the prefix.
+ //
+ if(!_logger)
+ {
+ _logger = getProcessLogger();
+ if(LoggerIPtr::dynamicCast(_logger))
+ {
+ _logger = new LoggerI(initData.properties->getProperty("Ice.ProgramName"));
+ setProcessLogger(_logger);
+ }
+ }
+
return run(argc, argv, initData);
}