您的位置:首页 > 其它

记录事件

2015-07-16 11:15 302 查看
class Program
    {

        static string EventSource = "WriteToHydee";

        static string logName = "WriteToHydeeExceptinLog";

        static void Main(string[] args)

        {

            if (!EventLog.SourceExists(EventSource))

            {

                var eventSource = new EventSourceCreationData(EventSource, logName);

                EventLog.CreateEventSource(eventSource);

            }

            EventLog log = new EventLog(logName,".",EventSource);

            log.WriteEntry("服务启动",EventLogEntryType.Information);

            log.Close();

            //Method.SynchIndent();

        }
    }

运行程序是以 管理员身份安装和运行。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: