How to create Windows EventLog source from command line?

后端 未结 8 1551
温柔的废话
温柔的废话 2020-11-27 09:28

I\'m creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledg

8条回答
  •  没有蜡笔的小新
    2020-11-27 09:58

    you can create your own custom event by using diagnostics.Event log class. Open a windows application and on a button click do the following code.

    System.Diagnostics.EventLog.CreateEventSource("ApplicationName", "MyNewLog");
    

    "MyNewLog" means the name you want to give to your log in event viewer.

    for more information check this link [ http://msdn.microsoft.com/en-in/library/49dwckkz%28v=vs.90%29.aspx]

提交回复
热议问题