Logback API
Version 0.9.8

ch.qos.logback.classic.spi
Class LoggingEvent

java.lang.Object
  extended by ch.qos.logback.classic.spi.LoggingEvent
All Implemented Interfaces:
Serializable

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 Logback components.

Writers of Logback components such as appenders should be aware of that some of the LoggingEvent fields are initialized lazily. Therefore, an appender wishing to output data to be later correctly read by a receiver, must initialize "lazy" fields prior to writing them out. See the prepareForDeferredProcessing() method for the exact list.

Author:
Ceki Gülcü, Sébastien Pennec
See Also:
Serialized Form

Constructor Summary
LoggingEvent()
           
LoggingEvent(String fqcn, Logger logger, Level level, String message, Throwable throwable, Object[] argArray)
           
 
Method Summary
 Object[] getArgumentArray()
           
 CallerData[] getCallerData()
          Get the caller information for this logging event.
 String getFormattedMessage()
           
 Level getLevel()
           
 LoggerRemoteView getLoggerRemoteView()
           
 Marker getMarker()
           
 Map<String,String> getMDCPropertyMap()
           
 String getMessage()
           
static long getStartTime()
          The time at which this class was loaded into memory, expressed in millisecond elapsed since the epoch (1.1.1970).
 String getThreadName()
           
 ThrowableInformation getThrowableInformation()
          Returns the throwable information contained within this event.
 long getTimeStamp()
           
 void prepareForDeferredProcessing()
          This method should be called prior to serializing an event.
 void setArgumentArray(Object[] argArray)
           
 void setCallerInformation(CallerData[] callerDataArray)
           
 void setLevel(Level level)
           
 void setLoggerRemoteView(LoggerRemoteView loggerRemoteView)
           
 void setMarker(Marker marker)
           
 void setMessage(String message)
           
 void setThreadName(String threadName)
           
 void setThrowableInformation(ThrowableInformation ti)
          Set this event's throwable information.
 void setTimeStamp(long timeStamp)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LoggingEvent

public LoggingEvent()

LoggingEvent

public LoggingEvent(String fqcn,
                    Logger logger,
                    Level level,
                    String message,
                    Throwable throwable,
                    Object[] argArray)
Method Detail

setArgumentArray

public void setArgumentArray(Object[] argArray)

getArgumentArray

public Object[] getArgumentArray()

getLevel

public Level getLevel()

getThreadName

public String getThreadName()

setThreadName

public void setThreadName(String threadName)
                   throws IllegalStateException
Parameters:
threadName - The threadName to set.
Throws:
IllegalStateException - If threadName has been already set.

getThrowableInformation

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


setThrowableInformation

public void setThrowableInformation(ThrowableInformation ti)
Set this event's throwable information.


prepareForDeferredProcessing

public void prepareForDeferredProcessing()
This method should be called prior to serializing an event. It should also be called when using asynchronous logging.

Note that due to performance concerns, this method does NOT extract caller data. It is the responsability of the calller to extract caller information.


getLoggerRemoteView

public LoggerRemoteView getLoggerRemoteView()

setLoggerRemoteView

public void setLoggerRemoteView(LoggerRemoteView loggerRemoteView)

getMessage

public String getMessage()

setMessage

public void setMessage(String message)

getTimeStamp

public long getTimeStamp()

setTimeStamp

public void setTimeStamp(long timeStamp)

setLevel

public void setLevel(Level level)

getStartTime

public static final long getStartTime()
The time at which this class was loaded into memory, expressed in millisecond elapsed since the epoch (1.1.1970).

Returns:
The time as measured when this class was loaded into memory.

getCallerData

public CallerData[] getCallerData()
Get the caller information for this logging event. If caller information is null at the time of its invocation, this method extracts location information. The collected information is cached for future use.

Note that after serialization it is impossible to correctly extract caller information.


setCallerInformation

public void setCallerInformation(CallerData[] callerDataArray)

getMarker

public Marker getMarker()

setMarker

public void setMarker(Marker marker)

getFormattedMessage

public String getFormattedMessage()

getMDCPropertyMap

public Map<String,String> getMDCPropertyMap()

toString

public String toString()
Overrides:
toString in class Object

Logback API
Version 0.9.8

Copyright © 2005-2008 QOS.ch. All Rights Reserved.