Creating an application and event logs in the “app

2019-06-24 11:46发布

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!

标签: c# event-log
1条回答
做个烂人
2楼-- · 2019-06-24 12:15

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

查看更多
登录 后发表回答