事件日志属性相关
如何在事件查看器 - 事件日志属性中为日志大小组框(在属性窗口、应用程序事件日志、WIndows XP 操作系统中的事件查看器中)编写 C#.NET 代码。
请向我提供相同的代码。
How to write C#.NET code for Log Size groupbox(in Properties window,Application eventlog,Eventviewer in WIndows XP OS) in EventViewer - Eventlog Properties.
Please provide me the code for the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为 sukumar 所问的是如何以编程方式更改 C# 中事件日志的大小?
如果右键单击事件日志(例如应用程序日志),然后选择属性。您将看到可以设置日志大小。
问题是假设您正在写入一个自定义日志。溢出操作设置为
DoNotOverwrite
(默认),如果不将其更改为OverwriteAsNeeded
,则会当日志变满时抛出异常< /强>。系统日志似乎默认有OverwriteOlder
。增加日志大小只会给你带来更大的历史记录......
I think what sukumar is asking is how can he programatically change the size of an event log in C#?
If you righ-click on an event log (eg the Application Log), and select properties. You will see there is a log size that you can set.
The problem is say you have a custom log that you are writing to. The overflow action is set to
DoNotOverwrite
(by default), if you don't change it toOverwriteAsNeeded
, you will throw an exception when the log becomes full. System logs seem to haveOverwriteOlder
as a default.Increasing the log size just gives you a bigger history...