EventLog .Evt file?
-
Hello, I have created a CustomEventLog. I am using the EventLogInstaller class and using Installutil.exe to install my log. However I notice that the MyCustomLog.Evt file is not being generated? Does anyone know how the .Evt file gets generated? Thanks so much for the help. RB
-
Hello, I have created a CustomEventLog. I am using the EventLogInstaller class and using Installutil.exe to install my log. However I notice that the MyCustomLog.Evt file is not being generated? Does anyone know how the .Evt file gets generated? Thanks so much for the help. RB
I don't know about using Installutil.exe to install an event log, but I do know that when you create an Event Source using EventLog.CreateEventSource(), the event log will be created automatically if it doesn't exist already.
if (!EventLog.SourceExists("SourceName"))
EventLog.CreateEventSource("SourceName", "LogName");will create an event log for you named
LogName.evt
(it will be in the \System32\config directory) with a Source ofSourceName
. To write to it:EventLog myLog = new EventLog("LogName",".","SourceName");
myLog.WriteEntry("Loggin my event...");Documentation: EventLog.CreateEventSource Method (String, String) [^] This method can also create a new custom log on the local computer.
--EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters
-
I don't know about using Installutil.exe to install an event log, but I do know that when you create an Event Source using EventLog.CreateEventSource(), the event log will be created automatically if it doesn't exist already.
if (!EventLog.SourceExists("SourceName"))
EventLog.CreateEventSource("SourceName", "LogName");will create an event log for you named
LogName.evt
(it will be in the \System32\config directory) with a Source ofSourceName
. To write to it:EventLog myLog = new EventLog("LogName",".","SourceName");
myLog.WriteEntry("Loggin my event...");Documentation: EventLog.CreateEventSource Method (String, String) [^] This method can also create a new custom log on the local computer.
--EricDV Sig--------- Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peters
Thank you.. I have been doing it this way as well. I just did not see my new LogName.evt showing up in my \System32\config directory. However I restarted my system and the file appeared. Go figure. Thank you. RB