I am trying to write to the Windows’ EventLog > Windows Logs > Application, I am pretty sure I’ve created everything that is needed, but when writing to it, it just throws an Unknown error (0xe06d7363)
without giving out any information. When checking for the EventSource
it does reported that the source exists.
The registry entry that was created, for example:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventLogApplicationMyApp
- A
ProviderGuid
under MyApp - A
EventMessageFile
under Myapp, that is pointing to%SystemRoot%System32mscoree.dll
When attempting to write to the EventLog, the following snippet was used:
if (!SourceExists)
{
// When debugging, it never went in here because
// I've already created the source in the registry
if (!EventLog.SourceExists(Source))
{
EventLog.CreateEventSource(new EventSourceCreationData("MyApp", "Application"));
SourceExists = true;
}
}
using (EventLog eventLog = new EventLog())
{
eventLog.Log = "Application";
eventLog.Source = "MyApp";
// the following line will throw Unknown error (0xe06d7363)
eventLog.WriteEntry("Hello world", EventLogEntryType.Information, 1000);
}
I am using event id 1000
because out of the box, mscoree.dll
, has a default format that just lets you dump the string as-is.
What else am I missing?