Difference between EventLog.WriteEntry and EventLog.WriteEvent methods

前端 未结 1 1897
轮回少年
轮回少年 2021-02-06 22:10

I tried using WriteEntry and WriteEvent methods of EventLog class.

EventLog.WriteEntry(\"Saravanan\", \"Application logs a         


        
1条回答
  •  天涯浪人
    2021-02-06 22:58

    EventLog.WriteEntry is a "quick and dirty" way to write to the event log where you can write a string. EventLog.WriteEvent enables you to take full advantage of the native Win32 API. However, to do that you are supposed to create a localized message file you then compile using the message compiler (mc.exe). Each event can contain substitution strings and can be localized to match the locale on the computer.

    To avoid this extra step of creating a message file the .Net wrapper for the event log API use messages that simply inserts the strings supplied as arguments. These message are used by EventLog.WriteEntry and are stored as embedded resources in EventLogMessages.dll in the .Net folder.

    Normally using EventLog.WriteEntry is adequate, but if you need to localize your messages or want to maintain them outside your source code you should create a message file and use EventLog.WriteEvent.

    0 讨论(0)
提交回复
热议问题