com.jniwrapper.win32.system.eventlog
Class EventLog

java.lang.Object
  extended bycom.jniwrapper.Parameter
      extended bycom.jniwrapper.Pointer.Void
          extended bycom.jniwrapper.win32.Handle
              extended bycom.jniwrapper.win32.system.eventlog.EventLog
All Implemented Interfaces:
com.jniwrapper.IntegerParameter, com.jniwrapper.PointerParameter

public class EventLog
extends Handle

This class provides functionality for working with system event logs.


Field Summary
 
Fields inherited from class com.jniwrapper.win32.Handle
INFINITE_TIMEOUT, INVALID_HANDLE_VALUE, STATUS_ABANDONED_WAIT_0, STATUS_TIMEOUT, STATUS_WAIT_0
 
Fields inherited from class com.jniwrapper.Parameter
LICENSE_TYPE, V
 
Constructor Summary
EventLog(java.lang.String logName)
          Opens an event log for reading.
EventLog(java.lang.String serverName, java.lang.String logName)
          Opens a remote event log for reading.
 
Method Summary
 void backup(java.io.File file)
          Backs up the opened event log to a file.
 void clear()
          Clears the opened event log.
 void close()
          Closes the event log handle.
 java.lang.String getLogName()
          Returns the name of the opened log.
 java.util.List getMessages()
          Returns the list of event log messages.
 int getRecordsCount()
          Returns the number of records in the event log.
 java.lang.String getServerName()
          If a remote event log has been opened, then the function returns the name of the remote server.
static EventLog openBackup(java.io.File backup)
          Opens the event log that was backed up.
static void reportEvent(EventLogMessage message)
          Posts the message to an event log.
 
Methods inherited from class com.jniwrapper.win32.Handle
clone, closeHandle, equals, waitFor, waitFor
 
Methods inherited from class com.jniwrapper.Pointer.Void
asFunction, asFunction, asTypedPointer, castTo, getDebugInfo, getLength, getValue, hashCode, isNull, read, setValue, toString, write
 
Methods inherited from class com.jniwrapper.Parameter
, a, a, acceptIOPerformer, asReturnValue, b, dataBufferAssigned, getAlignedLength, getAlignmentRequirement, getDataBuffer, getDataBufferOffset, indent, pop, push, read, read, setDataBuffer, toByteArray, write
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EventLog

public EventLog(java.lang.String logName)
Opens an event log for reading. If the specified event log cannot be found, the Application log will be opened.

Parameters:
logName - specifies the name of the log to be opened.

EventLog

public EventLog(java.lang.String serverName,
                java.lang.String logName)
Opens a remote event log for reading. If the specified event log cannot be found, the Application log will be opened.

Parameters:
serverName - is the UNC name of the server.
logName - specifies the name of the log to be opened.
Method Detail

getLogName

public java.lang.String getLogName()
Returns the name of the opened log.

Returns:
the name of the opened log.

getServerName

public java.lang.String getServerName()
If a remote event log has been opened, then the function returns the name of the remote server. Otherwise, the function returns null.

Returns:
the function returns the name of the remote server.

openBackup

public static EventLog openBackup(java.io.File backup)
Opens the event log that was backed up.

Parameters:
backup - specifies the backup file.
Returns:
opened event log.

backup

public void backup(java.io.File file)
Backs up the opened event log to a file.

Parameters:
file - specifies the backup file.

close

public void close()
Closes the event log handle.


clear

public void clear()
Clears the opened event log.


getRecordsCount

public int getRecordsCount()
Returns the number of records in the event log.

Returns:
the number of records in the event log.

getMessages

public java.util.List getMessages()
Returns the list of event log messages. Each element of the list is an instance of EventLogMessage.

Returns:
the list of event log messages.
See Also:
EventLogMessage

reportEvent

public static void reportEvent(EventLogMessage message)
Posts the message to an event log.

Parameters:
message - specifies the message to be posted.