From the EventLog Class documentation:
Quote:
Create the new event source during the installation of your application. This allows time for the operating system to refresh its list of registered event sources and their configuration. If the operating system hasn't refreshed its list of event sources, and you try to write an event with the new source, the write operation will fail. You can configure a new source by using an EventLogInstaller[^] object or the CreateEventSource[^] method. You must have administrative credentials on the computer to create a new event source.
An event source is a kind of identifier. This identifies your application as a source of events being written to the event logs.
An event source is usually created at install-time, in your apps installer, not at the run-time of your app. You can use the above classes to create this or you can just poke the registry keys and values in directly. See
Event Sources | Microsoft Docs[
^].