org.hyperic.sigar.win32
Class EventLog

java.lang.Object
  extended by org.hyperic.sigar.win32.Win32
      extended by org.hyperic.sigar.win32.EventLog

public class EventLog
extends Win32


Field Summary
static java.lang.String APPLICATION
           
static int EVENTLOG_AUDIT_FAILURE
           
static int EVENTLOG_AUDIT_SUCCESS
           
static int EVENTLOG_ERROR_TYPE
           
static int EVENTLOG_INFORMATION_TYPE
           
static int EVENTLOG_SUCCESS
           
static int EVENTLOG_WAIT_INFINITE
           
static int EVENTLOG_WARNING_TYPE
           
static java.lang.String SECURITY
           
static java.lang.String SYSTEM
           
 
Fields inherited from class org.hyperic.sigar.win32.Win32
EXE_EXT
 
Constructor Summary
EventLog()
          Create an event log.
 
Method Summary
 void close()
          Close the event log.
static java.lang.String[] getLogNames()
          Eventlog names are store in the registry under: SYSTEM\CurrentControlSet\Services\Eventlog This method returns the list of these entries.
 int getNewestRecord()
          Get the newest event log record.
 int getNumberOfRecords()
          Get the number of records for this event log
 int getOldestRecord()
          Get the oldest event log record
 void open(java.lang.String name)
          Open the event log.
 void openlog(java.lang.String name)
           
 EventLogRecord read(int recordOffset)
          Read an event log record.
 void waitForChange(int timeout)
          Wait for a change to the event log.
 
Methods inherited from class org.hyperic.sigar.win32.Win32
findExecutable, findScriptExecutable, getFileVersion, main
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SYSTEM

public static final java.lang.String SYSTEM
See Also:
Constant Field Values

APPLICATION

public static final java.lang.String APPLICATION
See Also:
Constant Field Values

SECURITY

public static final java.lang.String SECURITY
See Also:
Constant Field Values

EVENTLOG_SUCCESS

public static final int EVENTLOG_SUCCESS
See Also:
Constant Field Values

EVENTLOG_ERROR_TYPE

public static final int EVENTLOG_ERROR_TYPE
See Also:
Constant Field Values

EVENTLOG_WARNING_TYPE

public static final int EVENTLOG_WARNING_TYPE
See Also:
Constant Field Values

EVENTLOG_INFORMATION_TYPE

public static final int EVENTLOG_INFORMATION_TYPE
See Also:
Constant Field Values

EVENTLOG_AUDIT_SUCCESS

public static final int EVENTLOG_AUDIT_SUCCESS
See Also:
Constant Field Values

EVENTLOG_AUDIT_FAILURE

public static final int EVENTLOG_AUDIT_FAILURE
See Also:
Constant Field Values

EVENTLOG_WAIT_INFINITE

public static final int EVENTLOG_WAIT_INFINITE
See Also:
Constant Field Values
Constructor Detail

EventLog

public EventLog()
Create an event log.

Method Detail

open

public void open(java.lang.String name)
          throws Win32Exception
Open the event log. This must be done before any other operation.

Parameters:
name - Name of the event log to open. For example: "Application", "System" or "Security".
Throws:
Win32Exception - If opening the event log fails.

openlog

public void openlog(java.lang.String name)
             throws Win32Exception
Throws:
Win32Exception

close

public void close()
           throws Win32Exception
Close the event log.

Throws:
Win32Excepion - If closing of the event log fails.
Win32Exception

getNumberOfRecords

public int getNumberOfRecords()
                       throws Win32Exception
Get the number of records for this event log

Throws:
Win32Exception - If the event log is not open

getOldestRecord

public int getOldestRecord()
                    throws Win32Exception
Get the oldest event log record

Throws:
Win32Exception - If the event log is not open

getNewestRecord

public int getNewestRecord()
                    throws Win32Exception
Get the newest event log record.

Throws:
Win32Exception - If the event log is not open

read

public EventLogRecord read(int recordOffset)
                    throws Win32Exception
Read an event log record. This method only support the EVENTLOG_SEEK_READ flag, no sequential reading is currently supported.

Parameters:
recordOffset - The record offset to read.
Throws:
Win32Exception - If the event log is not open, or if the specified record could not be found

waitForChange

public void waitForChange(int timeout)
                   throws Win32Exception
Wait for a change to the event log. This function will return on event log change, or when the timeout pops. Windows PulseEvent will fire no more than once per 5 seconds, so multiple events may occur before the application is notified.

Parameters:
timeout - Time to wait in milliseconds.
Throws:
Win32Exception - If the event log is not open, or there is an error waiting for the the event.

getLogNames

public static java.lang.String[] getLogNames()
Eventlog names are store in the registry under: SYSTEM\CurrentControlSet\Services\Eventlog This method returns the list of these entries.

Returns:
All Eventlog names


Copyright ? 2004-2009 Hyperic. All Rights Reserved.