如何使用代码删除EventLog文件 [英] How to delete EventLog files using code
本文介绍了如何使用代码删除EventLog文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们!
我有一个将其值存储在Server中的EventLog文件中的应用程序.我可以使用Gridview查看这些文件.
现在我必须使用CLEAR按钮清除(删除)它们.可以吗?如果可以,怎么办?
请尽快回复.
谢谢与问候,
Ravi kamesh ..
Hi friends!
I''ve an application which stores its values in EventLog files in Server..I can view those files using Gridview..
Now I have to clear(delete) them using CLEAR button..Is it possible? If so, how?
Plz reply asap..
Thanks & Regards,
Ravi kamesh..
推荐答案
您可以尝试:
You can try:
if (System.Diagnostics.EventLog.Exists("MyCustomLog"))
{
System.Diagnostics.EventLog.Delete("MyCustomLog");
}
参考号:删除事件日志 [ ^ ]
看看:
http://msdn.microsoft.com/en-us/library/y0fwyz5a (v = vs.71).aspx [
Ref.:Delete Event Logs[^]
Have a look:
http://msdn.microsoft.com/en-us/library/y0fwyz5a(v=vs.71).aspx[^]
System.Diagnostics.EventLog.Clear
有什么问题?请参阅:
http://msdn.microsoft.com/en-us/library/system. diagnostics.eventlog.clear.aspx [ ^ ]. :-)
—SA
What''s wrong withSystem.Diagnostics.EventLog.Clear
? Please see:
http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.clear.aspx[^]. :-)
—SA
这篇关于如何使用代码删除EventLog文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文