How do I specify events deep inside “Applications and Services Logs”?

感情迁移 提交于 2019-12-05 23:00:00

The log name is Microsoft-Windows-TaskScheduler/Operational but I don't think you can access it using the EventLog class. I think that log is based on Event Tracing for Windows so you need to use the System.Diagnostics.Eventing.Reader namespace to access it.

The Event Log Scenarios page might be useful, in particular the How to: Subscribe to Events in an Event Log article might help you get started.

Update: The How to: Subscribe to Events in an Event Log code worked for me after I changed the log name (I also changed the query to request Level=4)...

EventLogQuery subscriptionQuery = new EventLogQuery(
    "Microsoft-Windows-TaskScheduler/Operational", PathType.LogName, "*[System/Level=4]");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!