Class EventLog
public class EventLog
{
// Fields
public static final short AUDIT_FAILURE;
public static final short AUDIT_SUCCESS;
public static final short ERROR;
public static final short INFORMATION;
public static final short SUCCESS;
public static final short WARNING;
// Constructors
public EventLog (String source);
public EventLog (String server, String source);
// Methods
protected void finalize ();
public void reportEvent (short type, short cat, int id,
String[] msg, byte[] data);
public void reportEvent (short type, short cat, int id,
String msg, byte[] data);
public void reportEvent (short type, short cat, int id,
String[] msgs);
public void reportEvent (short type, short cat, int id,
String msg);
public void reportEvent (short type, short cat, int id);
}
This class implements an event log. It is based directly upon the Microsoft® Win32® event log APIs, RegisterEventSource, ReportEvent, and DeregisterEventSource. For more information on implementing and using event logs, see the Win32 documentation.
public EventLog (String source);
Creates an EventLog object given the name of the source. This constructor calls the Win32 RegisterEventSource API.
Parameter | Description |
source
| The name of the source referenced by the EventLog object. The source name must be a subkey of a logfile entry under the EventLog key in the registry. Its value can be null.
|
public EventLog (String server, String source);
Creates an EventLog object given the name of the source and the name of the server. This constructor calls the Win32 RegisterEventSource API.
Parameter | Description |
server
| The Universal Naming Convention (UNC) name of the server that this operation is to be performed on.
|
source
| The name of the source referenced by the EventLog object. The source name must be a subkey of a logfile entry under the EventLog key in the registry. Its value can be null.
|
protected void finalize ();
De-registers the event source when the garbage collector detects there are no more references to this object. This method calls the Win32 DeregisterEventSource function.
Return Value:
No return value.
public void reportEvent (short type, short cat, int id, String[] msg,
byte[] data);
Writes an entry at the end of the event log, providing associated strings and binary data.
Return Value:
No return value.
Parameter | Description |
type
| The type of event being logged. The parameter can be one of the following types:
|
cat
| The event category. This is source-specific information; the category can have any value.
|
id
| The event identifier, which specifies the message that goes with this event as an entry in the message file associated with the event source.
|
msgs
| An array of strings that are merged into the message before the message is displayed to the user.
|
data
| The binary data associated with the report.
|
public void reportEvent (short type, short cat, int id, String msg,
byte[] data);
Writes an entry at the end of the event log, providing an associated string and binary data.
Return Value:
No return value.
Parameter | Description |
type
| The type of event being logged. The parameter can be one of the following types:
|
cat
| The event category. This is source-specific information; the category can have any value.
|
id
| The event identifier, specifies the message that goes with this event as an entry in the message file associated with the event source.
|
msg
| A string that is merged into the message before the message is displayed to the user.
|
data
| The binary data associated with the report.
|
public void reportEvent (short type, short cat, int id, String[] msgs);
Writes an entry at the end of the event log, providing associated strings.
Return Value:
No return value.
Parameter | Description |
type
| The type of event being logged. The parameter can be one of the following types:
|
cat
| The event category. This is source-specific information; the category can have any value.
|
id
| The event identifier, which specifies the message that goes with this event as an entry in the message file associated with the event source.
|
msgs
| An array of strings that are merged into the message before the message is displayed to the user.
|
public void reportEvent (short type, short cat, int id, String msg);
Writes an entry at the end of the event log, providing an associated string.
Return Value:
No return value.
Parameter | Description |
type
| The type of event being logged. The parameter can be one of the following types:
|
cat
| The event category. This is source-specific information; the category can have any value.
|
id
| The event identifier, which specifies the message that goes with this event as an entry in the message file associated with the event source.
|
msgs
| A string that is merged into the message before the message is displayed to the user.
|
public void reportEvent (short type, short cat, int id);
Writes an entry at the end of the event log.
Return Value:
No return value.
Parameter | Description |
type
| The type of event being logged. The parameter can be one of the following types:
|
cat
| The event category. This is source-specific information; the category can have any value.
|
id
| The event identifier, which specifies the message that goes with this event as an entry in the message file associated with the event source.
|
- AUDIT_FAILURE
- Indicates a failure audit event.
- AUDIT_SUCCESS
- Indicates a success audit event.
- ERROR
- Indicates an error event.
- INFORMATION
- Indicates an information event.
- SUCCESS
- Indicates a success event.
- WARNING
- Indicates a warning event.