Creating an application and event logs in the “applications and services logs” section of the event viewer

五迷三道 提交于 2019-12-10 17:12:53

问题


I have a .NET application in which I want to write unhandled events to the event viewer. I noticed that there is a directory called "Applications and Services Logs". I would like to create an entry for my application in this directory and write any unhandled events to it. Unfortunately, I can't find any documentation.

Is this even possible? If so, how?

Thanks!


回答1:


You can create a log entry with this method :

public static void CreateEventSource(
    string YourApplication,
    string YourLogName    )

CreateEventSource

Doc: 1: http://msdn.microsoft.com/en-us/library/2awhba7a.aspx

Example :Eventlog



来源:https://stackoverflow.com/questions/5171155/creating-an-application-and-event-logs-in-the-applications-and-services-logs-s

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!