Log4j 1.1.3

org.apache.log4j.spi
Class LoggingEvent

java.lang.Object
  |
  +--org.apache.log4j.spi.LoggingEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AppServerLoggingEvent

public class LoggingEvent
extends Object
implements Serializable

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.

Since:
0.8.2
Author:
Ceki Gülcü, James P. Cakalic
See Also:
Serialized Form

Field Summary
 Category category
          The category of the logging event.
 String categoryName
          The category name.
 String fqnOfCategoryClass
          Fully qualified name of the calling category class.
 Priority priority
          Priority of logging event.
 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, Object message, Throwable throwable)
          Instantiate a LoggingEvent from the supplied parameters.
 
Method Summary
 LocationInfo getLocationInformation()
          Set the location information for this logging event.
 Object getMessage()
          Return the message for this logging event.
 String getNDC()
           
 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

fqnOfCategoryClass

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

category

public transient Category category
The category of the logging event. The category field is not serialized for performance reasons.

It is set by the LoggingEvent constructor or set by a remote entity after deserialization.


categoryName

public final String categoryName
The category name.

priority

public transient Priority priority
Priority of logging event. Priority cannot be serializable because it is a flyweight. Due to its special seralization it cannot be declared final either.

timeStamp

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

LoggingEvent

public LoggingEvent(String fqnOfCategoryClass,
                    Category category,
                    Priority priority,
                    Object 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

getLocationInformation

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

getMessage

public Object getMessage()
Return the message for this logging event.

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.

Since:
1.1

getNDC

public String getNDC()

getRenderedMessage

public String getRenderedMessage()

getStartTime

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

getThreadName

public String getThreadName()

getThrowableInformation

public ThrowableInformation getThrowableInformation()
Returns the throwable information contained within this event. May be null if there is no such information.

Note that the Throwable object contained within a ThrowableInformation does not survive serialization.

Since:
1.1

getThrowableStrRep

public String[] getThrowableStrRep()
Return this event's throwable's string[] representaion.

Log4j 1.1.3

Please notify me about new log4j releases.