Package org.apache.log
Class LogEvent
- java.lang.Object
-
- org.apache.log.LogEvent
-
- All Implemented Interfaces:
java.io.Serializable
public final class LogEvent extends java.lang.Object implements java.io.SerializableThis class encapsulates each individual log event. LogEvents usually originate at a Logger and are routed to LogTargets.- Author:
- Avalon Development Team, Peter Donald
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringm_categoryprivate ContextMapm_contextMapprivate java.lang.Stringm_messageprivate Prioritym_priorityprivate java.lang.Throwablem_throwableprivate longm_timeprivate static longSTART_TIME
-
Constructor Summary
Constructors Constructor Description LogEvent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetCategory()Get the category that LogEvent relates to.ContextMapgetContextMap()Get ContextMap associated with LogEventjava.lang.StringgetMessage()Get the message associated with event.PrioritygetPriority()Get Priority for LogEvent.longgetRelativeTime()Get the time of the log event relative to start of application.java.lang.ThrowablegetThrowable()Get throwabe instance associated with event.longgetTime()Get the absolute time of the log event.private java.lang.ObjectreadResolve()Helper method that replaces deserialized priority with correct singleton.voidsetCategory(java.lang.String category)Set the LogEvent category.voidsetContextMap(ContextMap contextMap)Set the ContextMap for this LogEvent.voidsetMessage(java.lang.String message)Set the message for LogEvent.voidsetPriority(Priority priority)Set the priority of LogEvent.voidsetThrowable(java.lang.Throwable throwable)Set the throwable for LogEvent.voidsetTime(long time)Set the absolute time of LogEvent.
-
-
-
Field Detail
-
START_TIME
private static final long START_TIME
-
m_category
private java.lang.String m_category
-
m_message
private java.lang.String m_message
-
m_throwable
private java.lang.Throwable m_throwable
-
m_time
private long m_time
-
m_priority
private Priority m_priority
-
m_contextMap
private ContextMap m_contextMap
-
-
Method Detail
-
getPriority
public final Priority getPriority()
Get Priority for LogEvent.- Returns:
- the LogEvent Priority
-
setPriority
public final void setPriority(Priority priority)
Set the priority of LogEvent.- Parameters:
priority- the new LogEvent priority
-
getContextMap
public final ContextMap getContextMap()
Get ContextMap associated with LogEvent- Returns:
- the ContextMap
-
setContextMap
public final void setContextMap(ContextMap contextMap)
Set the ContextMap for this LogEvent.- Parameters:
contextMap- the context map
-
getCategory
public final java.lang.String getCategory()
Get the category that LogEvent relates to.- Returns:
- the name of category
-
getMessage
public final java.lang.String getMessage()
Get the message associated with event.- Returns:
- the message
-
getThrowable
public final java.lang.Throwable getThrowable()
Get throwabe instance associated with event.- Returns:
- the Throwable
-
getTime
public final long getTime()
Get the absolute time of the log event.- Returns:
- the absolute time
-
getRelativeTime
public final long getRelativeTime()
Get the time of the log event relative to start of application.- Returns:
- the time
-
setCategory
public final void setCategory(java.lang.String category)
Set the LogEvent category.- Parameters:
category- the category
-
setMessage
public final void setMessage(java.lang.String message)
Set the message for LogEvent.- Parameters:
message- the message
-
setThrowable
public final void setThrowable(java.lang.Throwable throwable)
Set the throwable for LogEvent.- Parameters:
throwable- the instance of Throwable
-
setTime
public final void setTime(long time)
Set the absolute time of LogEvent.- Parameters:
time- the time
-
readResolve
private java.lang.Object readResolve() throws java.io.ObjectStreamExceptionHelper method that replaces deserialized priority with correct singleton.- Returns:
- the singleton version of object
- Throws:
java.io.ObjectStreamException- if an error occurs
-
-