无法访问任务的事件日志 [英] Can't access event log for tasks
问题描述
我正在尝试访问"Microsoft-Windows-TaskScheduler/Operational"处的日志文件,但出现异常
字符串logName ="Microsoft-Windows-TaskScheduler/Operational";
EventLog log1 =新的EventLog(logName,"myMachine");
foreach(log1.Entries中的EventLogEntry条目)
{
}
//抛出异常:System.InvalidOperationException:计算机"myMachine"上的事件日志"Microsoft-Windows-TaskScheduler/Operational"不存在.
有人知道我需要做什么吗?
I am trying to access the log file at "Microsoft-Windows-TaskScheduler/Operational" but get an exception
string logName = "Microsoft-Windows-TaskScheduler/Operational";
EventLog log1 = new EventLog(logName, "myMachine");
foreach( EventLogEntry entry in log1.Entries )
{
}
// threw exception: System.InvalidOperationException: The event log ''Microsoft-Windows-TaskScheduler/Operational'' on computer ''myMachine'' does not exist..
Does anyone know what I need to do?
推荐答案
我认为您无法从EventLog类访问该日志文件.要查看它可以访问的事件日志列表,请将工具箱中的EventLog组件放到表单上并查看log属性,它将为您提供可以访问的事件日志的下拉列表.
I don''t think you can access that log file from the EventLog class. To see the list of event logs that it can access put an EventLog component from the toolbox onto a form and look at the log property, it will give you a drop down of event logs that you can access.
这篇关于无法访问任务的事件日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!