java.lang.Objectorg.apache.log4j.spi.LoggingEvent
The internal representation of logging events. When an affirmative
decision is made to log then a LoggingEvent
instance
is created. This instance is passed around to the different log4j
components.
This class is of concern to those wishing to extend log4j.
Field Summary | |
String |
categoryName
The category (logger) name. |
String |
fqnOfCategoryClass
Fully qualified name of the calling category class. |
Priority |
level
Level of logging event. |
Category |
logger
The category of the logging event. |
long |
timeStamp
The number of milliseconds elapsed from 1/1/1970 until logging event was created. |
Constructor Summary | |
LoggingEvent(String fqnOfCategoryClass,
Category logger,
long timeStamp,
Priority priority,
Object message,
Throwable throwable)
Instantiate a LoggingEvent from the supplied parameters. |
|
LoggingEvent(String fqnOfCategoryClass,
Category logger,
Priority priority,
Object message,
Throwable throwable)
Instantiate a LoggingEvent from the supplied parameters. |
Method Summary | |
LocationInfo |
getLocationInformation()
Set the location information for this logging event. |
Object |
getMDC(String key)
Returns the the context corresponding to the key
parameter. |
void |
getMDCCopy()
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging. |
Object |
getMessage()
Return the message for this logging event. |
String |
getNDC()
This method returns the NDC for this event. |
String |
getRenderedMessage()
|
static long |
getStartTime()
Returns the time when the application started, in milliseconds elapsed since 01.01.1970. |
String |
getThreadName()
|
ThrowableInformation |
getThrowableInformation()
Returns the throwable information contained within this event. |
String[] |
getThrowableStrRep()
Return this event's throwable's string[] representaion. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final transient String fqnOfCategoryClass
public transient Category logger
It is set by the LoggingEvent constructor or set by a remote entity after deserialization.
public final String categoryName
public transient Priority level
public final long timeStamp
Constructor Detail |
public LoggingEvent(String fqnOfCategoryClass, Category logger, Priority priority, Object message, Throwable throwable)
Except timeStamp
all the other fields of
LoggingEvent
are filled when actually needed.
message
- The message of this event.throwable
- The throwable of this event.public LoggingEvent(String fqnOfCategoryClass, Category logger, long timeStamp, Priority priority, Object message, Throwable throwable)
Except timeStamp
all the other fields of
LoggingEvent
are filled when actually needed.
timeStamp
- the timestamp of this logging eventmessage
- The message of this event.throwable
- The throwable of this event.Method Detail |
public LocationInfo getLocationInformation()
public Object getMessage()
Before serialization, the returned object is the message passed by the user to generate the logging event. After serialization, the returned value equals the String form of the message possibly after object rendering.
public String getNDC()
NDC.get()
method
should never be called directly.
public Object getMDC(String key)
key
parameter. If there is a local MDC copy, possibly because we are
in a logging server or running inside AsyncAppender, then we
search for the key in MDC copy, if a value is found it is
returned. Otherwise, if the search in MDC copy returns a null
result, then the current thread's MDC
is used.
Note that both the local MDC copy and the current thread's MDC are searched.
public void getMDCCopy()
public String getRenderedMessage()
public static long getStartTime()
public String getThreadName()
public ThrowableInformation getThrowableInformation()
null
if there is no such information.
Note that the Throwable
object contained within a
ThrowableInformation
does not survive serialization.
public String[] getThrowableStrRep()
Copyright © 2000 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.