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();

posted @ 2008-10-14 16:16  昕友软件开发  阅读(390)  评论(0编辑  收藏  举报
欢迎访问我的开源项目:xyIM企业即时通讯