EventLog的几种参数写法

using System.Diagnostics;

 

 

if (!EventLog.SourceExists("EventLogDemoApp"))
            {
                EventSourceCreationData eventSourceData =
                      new EventSourceCreationData("EventlogDemoApp", "ProCSharpLog");

                EventLog.CreateEventSource(eventSourceData);
            }

            EventLog log = new EventLog("ProCSharpLog", ".", "EventLogDemoApp");
            log.WriteEntry("Message 1");
            log.WriteEntry("Message 2", EventLogEntryType.Warning);
            log.WriteEntry("Message 3", EventLogEntryType.Information, 33);
            log.Dispose();

你可能感兴趣的:(event)