EventLog

 //HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application

            string source = "WCF Event Log";
            if (!EventLog.SourceExists(source))
            {
                EventLog.CreateEventSource(source, "Application");
            }

            EventLog myLog = new EventLog();
            myLog.Source = source;
            myLog.WriteEntry("1111", EventLogEntryType.Error);

原文地址:https://www.cnblogs.com/RobotTech/p/1914006.html