Class LogEvent
java.lang.Object
org.apache.log.LogEvent
- All Implemented Interfaces:
Serializable
This 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe category that this LogEvent concerns.private ContextMapThe context map associated with LogEvent.private StringThe message to be logged.private PriorityThe priority of LogEvent.private ThrowableThe exception that caused LogEvent if any.private longThe time in millis that LogEvent occurredprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringGet the category that LogEvent relates to.final ContextMapGet ContextMap associated with LogEventfinal StringGet the message associated with event.final PriorityGet Priority for LogEvent.final longGet the time of the log event relative to start of application.final ThrowableGet throwabe instance associated with event.final longgetTime()Get the absolute time of the log event.private ObjectHelper method that replaces deserialized priority with correct singleton.final voidsetCategory(String category) Set the LogEvent category.final voidsetContextMap(ContextMap contextMap) Set the ContextMap for this LogEvent.final voidsetMessage(String message) Set the message for LogEvent.final voidsetPriority(Priority priority) Set the priority of LogEvent.final voidsetThrowable(Throwable throwable) Set the throwable for LogEvent.final voidsetTime(long time) Set the absolute time of LogEvent.
-
Field Details
-
START_TIME
private static final long START_TIME -
m_category
The category that this LogEvent concerns. (Must not be null) -
m_message
The message to be logged. (Must not be null) -
m_throwable
The exception that caused LogEvent if any. (May be null) -
m_time
private long m_timeThe time in millis that LogEvent occurred -
m_priority
The priority of LogEvent. (Must not be null) -
m_contextMap
The context map associated with LogEvent. (May be null).
-
-
Constructor Details
-
LogEvent
public LogEvent()
-
-
Method Details
-
getPriority
-
setPriority
Set the priority of LogEvent.- Parameters:
priority- the new LogEvent priority
-
getContextMap
Get ContextMap associated with LogEvent- Returns:
- the ContextMap
-
setContextMap
Set the ContextMap for this LogEvent.- Parameters:
contextMap- the context map
-
getCategory
Get the category that LogEvent relates to.- Returns:
- the name of category
-
getMessage
-
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
Set the LogEvent category.- Parameters:
category- the category
-
setMessage
Set the message for LogEvent.- Parameters:
message- the message
-
setThrowable
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
Helper method that replaces deserialized priority with correct singleton.- Returns:
- the singleton version of object
- Throws:
ObjectStreamException- if an error occurs
-