Following this answer I made a very simple console application that writes something to the event viewer:
class Program
{
static void Main(string[] args)
{
for(int i=0;i<10000;i++)
{
Console.Write(".");
}
Console.WriteLine("Preparing to write into Event log");
using (EventLog eventLog = new EventLog("Application"))
{
eventLog.Source = "Application";
eventLog.WriteEntry("Log message example", EventLogEntryType.Information, 101, 1);
}
Console.WriteLine("I wrote to the event log. Press a key");
Console.ReadLine();
}
}
Then checking the event viewer, I do have an event that says "Log message example"! Yeahh!
However as part of the message I also got:(text translated by google)
Explanation of event ID 101 from source "Application" can not be found. The component that caused this event is not installed on the local computer or the installation is corrupted. Install the component on the local computer or repair the component.
If the event originates from another computer, you need to save the display information along with the event.
The event contains the following information:
Log message example
A message resource exists but a message could not be found in the message table.
What does this message mean?
My objective is just to write some message to the event viewer for later debug (obviously the above code is just a mock example, not the way I am going to finally use it)