public class Event extends java.lang.Object implements Event
| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap<java.lang.String,java.lang.Object> |
attribute |
protected java.lang.Object |
body |
protected int |
deliveryMode |
static java.lang.String |
ESCAPED_AMPERSAND |
static java.lang.String |
ESCAPED_CARRIAGE_RETURN |
static java.lang.String |
ESCAPED_EQUAL |
static java.lang.String |
ESCAPED_ITEM_SEPARATOR |
static java.lang.String |
ESCAPED_QUOTE |
protected int |
eventID |
protected long |
expiration |
protected int |
groupID |
static java.lang.String |
ITEM_SEPARATOR |
static int |
LOG_CENTRAL |
static int |
LOG_COMPACT |
static int |
LOG_JMS |
static int |
LOG_LOCAL |
static int |
LOG_SYSLOG |
protected int |
logMode |
protected long |
timestamp |
| Constructor and Description |
|---|
Event(int priority) |
Event(int priority,
java.lang.String message) |
Event(int priority,
java.lang.String message,
java.lang.String filename) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
attributeExists(java.lang.String name)
tests if the attribute exists on the key
|
void |
clearAttributes()
clears all attributes of the event
|
static java.lang.String |
dateFormat(java.util.Date date) |
protected void |
finalize() |
static void |
flush(java.lang.Throwable e)
It prints out error msg and rethrows it if it is an Error
|
java.lang.String |
getAttribute(java.lang.String name)
returns the attribute on the key
|
java.util.Set<java.lang.String> |
getAttributeNames()
returns the iterator for all the keys of attributes
|
java.lang.Object |
getBody() |
protected static java.lang.String |
getDefaultName() |
long |
getExpiration()
returns the expiration of the event
|
int |
getGroupID() |
static int |
getHostID() |
static java.lang.String |
getHostName() |
static java.lang.String |
getIPAddress() |
static int |
getPID() |
int |
getPriority()
returns the priority of the event
|
static int |
getPriorityByName(java.lang.String name)
returns priority in number or -1 on a bad priority name
|
static java.lang.String |
getProgramName() |
long |
getTimestamp()
returns the timestamp of the event
|
void |
log()
logs to the file according to programName
|
static java.util.Date |
parseDate(java.lang.String date) |
void |
print(java.io.PrintStream stream) |
java.lang.String |
removeAttribute(java.lang.String name)
removes the attribute on the key
|
void |
send() |
void |
setAttribute(java.lang.String name,
java.lang.String value)
It sets an attribute of the Event
|
void |
setBody(java.lang.Object obj)
It sets the body of the Event with an Object which may not be
transportable.
|
static void |
setDefaultCategory(java.lang.String category) |
static void |
setDefaultName(java.lang.String name) |
static void |
setDefaultSite(java.lang.String site) |
static void |
setDefaultType(java.lang.String type) |
void |
setExpiration(long ts)
sets the expiration of the event
|
void |
setGroupID(int gid) |
static void |
setLogDir(java.lang.String dir)
It sets the log dir and initializes the logger without date pattern.
|
static void |
setLogDir(java.lang.String dir,
java.lang.String datePattern)
It sets the log dir for the events and initializes the logger with the
given date pattern.
|
static void |
setLogDir(java.lang.String dir,
java.lang.String maxSize,
int maxBackups)
It sets the log dir for the events and initializes the logger with the
given size limit and number of backups
|
void |
setPriority(int p)
sets the priority of the event
|
void |
setTimestamp(long ts)
sets the timestamp of the event
|
static java.lang.String |
traceStack(java.lang.Throwable e) |
public static final int LOG_LOCAL
public static final int LOG_CENTRAL
public static final int LOG_COMPACT
public static final int LOG_JMS
public static final int LOG_SYSLOG
protected int eventID
protected int groupID
protected int logMode
protected int deliveryMode
protected long timestamp
protected long expiration
protected final java.util.HashMap<java.lang.String,java.lang.Object> attribute
protected java.lang.Object body
public static final java.lang.String ITEM_SEPARATOR
public static final java.lang.String ESCAPED_ITEM_SEPARATOR
public static final java.lang.String ESCAPED_CARRIAGE_RETURN
public static final java.lang.String ESCAPED_AMPERSAND
public static final java.lang.String ESCAPED_QUOTE
public static final java.lang.String ESCAPED_EQUAL
public Event(int priority)
public Event(int priority,
java.lang.String message)
public Event(int priority,
java.lang.String message,
java.lang.String filename)
public static int getPriorityByName(java.lang.String name)
public static int getPID()
public static int getHostID()
public static java.lang.String getIPAddress()
public static java.lang.String getHostName()
public static java.lang.String getProgramName()
public long getTimestamp()
EventgetTimestamp in interface Eventpublic void setTimestamp(long ts)
EventsetTimestamp in interface Eventpublic long getExpiration()
EventgetExpiration in interface Eventpublic void setExpiration(long ts)
EventsetExpiration in interface Eventpublic int getPriority()
EventgetPriority in interface Eventpublic void setPriority(int p)
EventsetPriority in interface Eventpublic int getGroupID()
public void setGroupID(int gid)
public java.lang.String getAttribute(java.lang.String name)
EventgetAttribute in interface Eventpublic void setAttribute(java.lang.String name,
java.lang.String value)
setAttribute in interface Eventname - the name of the attributevalue - the value of the attributepublic java.util.Set<java.lang.String> getAttributeNames()
EventgetAttributeNames in interface Eventpublic void clearAttributes()
EventclearAttributes in interface Eventpublic void setBody(java.lang.Object obj)
public java.lang.Object getBody()
public java.lang.String removeAttribute(java.lang.String name)
EventremoveAttribute in interface Eventpublic boolean attributeExists(java.lang.String name)
EventattributeExists in interface Eventpublic static void setLogDir(java.lang.String dir)
public static void setLogDir(java.lang.String dir,
java.lang.String datePattern)
public static void setLogDir(java.lang.String dir,
java.lang.String maxSize,
int maxBackups)
public static void setDefaultName(java.lang.String name)
protected static java.lang.String getDefaultName()
public static void setDefaultSite(java.lang.String site)
public static void setDefaultCategory(java.lang.String category)
public static void setDefaultType(java.lang.String type)
public void print(java.io.PrintStream stream)
public void send()
public static void flush(java.lang.Throwable e)
public static java.lang.String traceStack(java.lang.Throwable e)
public static java.lang.String dateFormat(java.util.Date date)
public static java.util.Date parseDate(java.lang.String date)
public void log()
protected void finalize()
finalize in class java.lang.Object