Log4j 0.9.1

org.log4j.spi
Class LoggingEvent

java.lang.Object
  |
  +--org.log4j.spi.LoggingEvent
All Implemented Interfaces:
Serializable

public class LoggingEvent
extends Object
implements Serializable

The internal representation of logging events. When a affirmative logging decision is made a LoggingEvent instance is created. This instance is passed around the different log4j components.

This class is of concern to those wishing to extend log4j.

Since:
0.8.2
Author:
Ceki Gülcü, Jim Cakalic
See Also:
Serialized Form

Field Summary
 String categoryName
          The category name.
 String fqnOfCategoryClass
          Fully qualified name of the calling category class.
 LocationInfo locationInfo
          Location information for the caller.
 String message
          The application supplied message of logging event.
 String ndc
          The nested diagnostic context (NDC) of logging event.
 boolean ndcLookupRequired
          Have we tried to do an NDC lookup? If we did, there is no need to do it again.
 Priority priority
          Priority of logging event.
 String threadName
          The name of thread in which this logging event was generated.
 Throwable throwable
          The throwable associated with this logging event.
 String throwableInformation
          This variable collects the info on a throwable.
 long timeStamp
          The number of milliseconds elapsed from 1/1/1970 until logging event was created.
 
Constructor Summary
LoggingEvent(String fqnOfCategoryClass, Category category, Priority priority, String message, Throwable throwable)
          Instantiate a LoggingEvent from the supplied parameters.
 
Method Summary
 String getNDC()
           
static long getStartTime()
          Returns the time when the application started, in milliseconds elapsed since 01.01.1970.
 String getThreadName()
           
 String getThrowableInformation()
           
 void setLocationInformation()
          Set the location information for this logging event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fqnOfCategoryClass

public transient String fqnOfCategoryClass
Fully qualified name of the calling category class.

categoryName

public String categoryName
The category name.

priority

public transient Priority priority
Priority of logging event. Priority cannot be serializable because it is a flyweight.

ndc

public String ndc
The nested diagnostic context (NDC) of logging event.

ndcLookupRequired

public boolean ndcLookupRequired
Have we tried to do an NDC lookup? If we did, there is no need to do it again. Note that its value is always false when serialized. Thus, a receiving SocketNode will never use it's own (incorrect) NDC. See also writeObject method.

message

public String message
The application supplied message of logging event.

threadName

public String threadName
The name of thread in which this logging event was generated.

throwable

public transient Throwable throwable
The throwable associated with this logging event. This is field is transient because not all exception are serializable. More importantly, the stack information does not survive serialization.

throwableInformation

public String throwableInformation
This variable collects the info on a throwable. This variable will be shipped to

timeStamp

public long timeStamp
The number of milliseconds elapsed from 1/1/1970 until logging event was created.

locationInfo

public LocationInfo locationInfo
Location information for the caller.
Constructor Detail

LoggingEvent

public LoggingEvent(String fqnOfCategoryClass,
                    Category category,
                    Priority priority,
                    String message,
                    Throwable throwable)
Instantiate a LoggingEvent from the supplied parameters.

Except timeStamp all the other fields of LoggingEvent are filled when actually needed.

Parameters:
category - The category of this event.
priority - The priority of this event.
message - The message of this event.
throwable - The throwable of this event.
Method Detail

getStartTime

public static long getStartTime()
Returns the time when the application started, in milliseconds elapsed since 01.01.1970.

getNDC

public String getNDC()

getThreadName

public String getThreadName()

getThrowableInformation

public String getThrowableInformation()

setLocationInformation

public void setLocationInformation()
Set the location information for this logging event. The collected information is cached for future use.

Log4j 0.9.1

Please notify me about new log4j releases.