Writing to event log in C++/CLR application

  • Thread starter Thread starter its_me_here
  • Start date Start date
I

its_me_here

Guest
I am trying to write to event log from a C++/CLR dll . Here is the code.

String ^sSource;
String ^sLog;
String ^sEvent;

sSource = gcnew String("System");
sLog = gcnew String("Application1");
sEvent = gcnew String("Sample Event1");

if (!EventLog::SourceExists(sSource))
EventLog::CreateEventSource(sSource, sLog);

EventLog::WriteEntry(sSource, sEvent);
EventLog::WriteEntry(sSource, sEvent,
EventLogEntryType::Warning, 234);
I am calling this C++/CLR dll from a Windows service. But the logging does not happen. What could be wrong here?

Continue reading...
 
Back
Top