Creates an array of the event logs.
Searches for all event logs on the given computer and creates an array of EventLog objects to contain the list.
[Visual Basic] Overloads Public Shared Function GetEventLogs(String) As EventLog ()
[C#] public static EventLog[] GetEventLogs(String);
[C++] public: static EventLog* GetEventLogs(String*) [];
[JScript] public static function GetEventLogs(String) : EventLog[];
Searches for all event logs on the local computer and creates an array of EventLog objects to contain the list.
[Visual Basic] Overloads Public Shared Function GetEventLogs() As EventLog ()
[C#] public static EventLog[] GetEventLogs();
[C++] public: static EventLog* GetEventLogs() [];
[JScript] public static function GetEventLogs() : EventLog[];
The following example gets a list of logs on the local computer. It then outputs the name of each log.
Import the System.Diagnostics namespace for this example.
Note This example shows how to use one of the overloaded versions of GetEventLogs. For other examples that may be available, see the individual overload topics.
[Visual Basic]
Private Sub GetLogList() 'Declare an array of event logs. Dim EventLogList() As EventLog 'This is used in a for loop Dim i As Integer 'Show the name of each event log on the local computer. EventLogList = EventLog.GetEventLogs For i = 0 To EventLogList.Length - 1 Console.WriteLine(EventLogList(i).Log) Next End Sub
EventLog Class | EventLog Members | System.Diagnostics Namespace