JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the EventLog Class

The EventLog class supports access to Windows event logs from Windows services. Here is the inheritance hierarchy of this class:

Object
   MarshalByRefObject
      Component
         EventLog

You can find the more notable public class methods of EventLog in Table 25.3, the more notable public properties of EventLog objects in Table 25.4, their more notable methods in Table 25.5, and their more notable events in Table 25.6.

Table 25.3: Noteworthy public class (shared) methods of the EventLog class.

Method

Means

CreateEventSource

Enables an application to write event data to a log.

Delete

Removes a log.

DeleteEventSource

Removes an application's event source registration.

Exists

Indicates if a log exists.

GetEventLogs

Returns an array of event logs.

LogNameFromSourceName

Gets the name of the log a source is registered with.

SourceExists

Checks for a specific event source.

WriteEntry

Writes an entry in the log.

Table 25.4: Noteworthy public properties of EventLog objects.

Property

Means

EnableRaisingEvents

Gets/sets if the event log gets EntryWritten events.

Entries

Gets the contents of the log.

Log

Gets/sets the name of the log.

LogDisplayName

Gets the log's display name.

MachineName

Gets/sets the name of the log's computer.

Source

Gets/sets the source name to use when writing to the log.

Table 25.5: Noteworthy public methods of EventLog objects.

Method

Means

BeginInit

Begins the initialization operation of an event log.

Clear

Clears all entries from the log.

Close

Closes the log.

EndInit

Ends the initialization operation of an event log.

WriteEntry

Writes an entry in the event log.

Table 25.6: Noteworthy public events of EventLog objects.

Event

Means

EntryWritten

Occurs when data is written to an event log.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor