To create an event log with our custom LogName, first check the source’s existence then add it if not.

 if (!EventLog.SourceExists("FolderMonitor-OnCreated", "."))
                EventLog.CreateEventSource("FolderMonitor-OnCreated", "SCM");

The source has to be registered with other log before. And the log file will be created under


We want to keep it meaningful, so use few different “source” to identify the vent types in order for us to pre-view them from the list and to know them without viewing each log.

To specify the account, double-click on the ProjectInstaller to view code. Then specify the account in the constructor

//# Service Account Information

            serviceProcessInstaller.Account = System.ServiceProcess.ServiceAccount.User;