summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/EventLoggerI.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2005-01-14 00:22:54 +0000
committerMark Spruiell <mes@zeroc.com>2005-01-14 00:22:54 +0000
commitd485a028d4bc4b1ce0456efce218609e89b4f3ab (patch)
tree9715ed3ffaf4ac7f0575e807a2bfb337bcfe74d4 /cpp/src/Ice/EventLoggerI.cpp
parentadding InitializationException (diff)
downloadice-d485a028d4bc4b1ce0456efce218609e89b4f3ab.tar.bz2
ice-d485a028d4bc4b1ce0456efce218609e89b4f3ab.tar.xz
ice-d485a028d4bc4b1ce0456efce218609e89b4f3ab.zip
bug fixes for missing appname, mismatched event source
Diffstat (limited to 'cpp/src/Ice/EventLoggerI.cpp')
-rwxr-xr-xcpp/src/Ice/EventLoggerI.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/cpp/src/Ice/EventLoggerI.cpp b/cpp/src/Ice/EventLoggerI.cpp
index 03ed4f96439..7902a71b20a 100755
--- a/cpp/src/Ice/EventLoggerI.cpp
+++ b/cpp/src/Ice/EventLoggerI.cpp
@@ -18,6 +18,13 @@ HMODULE Ice::EventLoggerI::_module = NULL;
Ice::EventLoggerI::EventLoggerI(const string& appName) :
_appName(appName), _source(NULL)
{
+ if(appName.empty())
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "event logger requires a value for Ice.ProgramName";
+ throw ex;
+ }
+
//
// We first need to ensure that there is a registry entry for this application
// under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application.
@@ -86,7 +93,10 @@ Ice::EventLoggerI::EventLoggerI(const string& appName) :
RegCloseKey(hKey);
- _source = RegisterEventSource(NULL, appName.c_str());
+ //
+ // The event source must match the registry key.
+ //
+ _source = RegisterEventSource(NULL, _appName.c_str());
if(_source == NULL)
{
SyscallException ex(__FILE__, __LINE__);