0

I am running this on Windows 8.1 version 6.3.9600 I would really need some help with the most basic simplistic application that writes to Event Log. This is the code I have:

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            EventLog.WriteEntry("Testing Application", "Testing data", EventLogEntryType.Information, 100);
        }
    }
}

After the execution I get an exception saying that: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security.

But If I add the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\Testing Application and add value TypesSupported with data 7 then there is no exception, but the event entry displays all this:

The description for Event ID 100 from source Testing Application cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Testing data

the message resource is present but the message is not found in the string/message table

Is there anything I can do to display only the text "Testing data" in the event log? Or does Windows 8.1 work differently and I didn't know that?

Kind Regards

Damjan

Dado Smeks
  • 1
  • 1
  • 1

2 Answers2

0

You need to setup the message file for the event viewer. Have a look at Description for event id from source cannot be found

Community
  • 1
  • 1
Ben T
  • 4,656
  • 3
  • 22
  • 22
0

Check out this answer it does exactly what you need (write an event log entry without the "description not found" error and without registering custom event sources

Alex from Jitbit
  • 53,710
  • 19
  • 160
  • 149