当前位置:编程学习 > C#/ASP.NET >>

如何实现自动删除系统日志里面指定的日志(事件日志)?

有一个错误日志一分钟出现好几次,event id 7016,The %ServiceName% service has reported an invalid current state 0. 但是这个Service还不能停掉。我就想能否有办法实现自动把event id 为7016的删掉。没隔一段时间执行一次。 --------------------编程问答-------------------- 那个好像在注册表里,到网上找找这方面资料。 --------------------编程问答-------------------- 在windows服务中使用eventlog删除日志
if (EventLog.SourceExists(""))
            {
                string logName = EventLog.LogNameFromSourceName("", ".");
                EventLog.DeleteEventSource("");
                EventLog.Delete(logName);
            }   
--------------------编程问答-------------------- 不明白楼上 帮顶了 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- EventLog 类。
MSDN查之。
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,