我如何阅读 Windows 服务的事件日志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2299143/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 13:58:59  来源:igfitidea点击:

How do i read the eventlog of windows service

c#windowsevent-log

提问by Kazoom

I am trying to modify an already written Windows service.

我正在尝试修改一个已经编写好的 Windows 服务。

I see the source has an System.diagnostic.EventLog object which logs different action of the service.

我看到源有一个 System.diagnostic.EventLog 对象,它记录了服务的不同操作。

I am trying to figure out how do i read this log. From semantics it seems that Eventlog is logging several actions of service.

我想弄清楚如何阅读此日志。从语义上看,Eventlog 似乎记录了多个服务操作。

where is this log stored, how can i see it, i need access to it as my service sometimes stop intermittently.

这个日志存储在哪里,我怎么能看到它,我需要访问它,因为我的服务有时会间歇性地停止。

I tried to google it but did not find any solid answers. Putting the questions simply what is an eventlong and how do i use it.

我试图谷歌它,但没有找到任何可靠的答案。将问题简单地放在什么是 eventlong 以及我如何使用它。

回答by Eight-Bit Guru

In 'Computer Management' you'll see an entry labelled 'Event Viewer'. Depending on which version of Windows you're running, there will be several sub-entries below this conforming to each of the event logs Windows maintains. Your application will probably be logging to the 'Application' log, although it might also log to 'System'. Click these subitems to have their log contents show up in the central pane.

在“计算机管理”中,您将看到一个标记为“事件查看器”的条目。根据您运行的 Windows 版本,下面将有几个子条目符合 Windows 维护的每个事件日志。您的应用程序可能会记录到“应用程序”日志,尽管它也可能会记录到“系统”。单击这些子项以使其日志内容显示在中央窗格中。