gpt4 book ai didi

时间:2019-03-17 标签:c#EventlogFullorNot

转载 作者:行者123 更新时间:2023-12-03 05:14:59 28 4
gpt4 key购买 nike

现在如何确定应用程序事件日志是否已满。有任何选项可以清除应用程序事件日志中的所有事件。我的代码是

 EventLog log = new EventLog("Application");
log.Source = "Voting Editor Tool";
log.WriteEntry(ex.Message);

最佳答案

你可以尝试catch

try
{
EventLog log = new EventLog("Application");
log.Source = "Voting Editor Tool";
log.WriteEntry(ex.Message);
}
catch (Win32Exception w32ex)
{
// full
}

要清除事件日志,请使用

log.clear();

引自文档。

Event logs are set with a maximum size that determines how many entries they can contain. When an event log is full, it stops recording new event information or begins to overwrite earlier entries. If event recording stops, you can use this method to clear the log of existing entries and allow it to start recording events again. You must have administrator permissions to the computer on which the log resides to clear event log entries.

关于时间:2019-03-17 标签:c#EventlogFullorNot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6372122/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com