Package org.apache.log4j.spi
Class LoggingEvent
- java.lang.Object
-
- org.apache.log4j.spi.LoggingEvent
-
- Direct Known Subclasses:
LogEventAdapter
public class LoggingEvent extends Object
No-op version of Log4j 1.2 LoggingEvent. This class is not directly used by Log4j 1.x clients but is used by the Log4j 2 LogEvent adapter to be compatible with Log4j 1.x components.
-
-
Constructor Summary
Constructors Constructor Description LoggingEvent()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetFQNOfLoggerClass()LevelgetLevel()Return the level of this event.LocationInfogetLocationInformation()Set the location information for this logging event.CategorygetLogger()Gets the logger of the event.StringgetLoggerName()Return the name of the logger.ObjectgetMDC(String key)voidgetMDCCopy()Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.ObjectgetMessage()Return the message for this logging event.StringgetNDC()MapgetProperties()StringgetProperty(String key)SetgetPropertyKeySet()StringgetRenderedMessage()static longgetStartTime()Returns the time when the application started, in milliseconds elapsed since 01.01.1970.StringgetThreadName()ThrowableInformationgetThrowableInformation()Returns the throwable information contained within this event.String[]getThrowableStrRep()Return this event's throwable's string[] representaion.longgetTimeStamp()ObjectremoveProperty(String propName)voidsetProperty(String propName, String propValue)
-
-
-
Method Detail
-
getLocationInformation
public LocationInfo getLocationInformation()
Set the location information for this logging event. The collected information is cached for future use.
-
getLevel
public Level getLevel()
Return the level of this event. Use this form instead of directly accessing thelevelfield.
-
getLoggerName
public String getLoggerName()
Return the name of the logger. Use this form instead of directly accessing thecategoryNamefield.
-
getFQNOfLoggerClass
public String getFQNOfLoggerClass()
-
getTimeStamp
public final long getTimeStamp()
-
getLogger
public Category getLogger()
Gets the logger of the event. Use should be restricted to cloning events.- Since:
- 1.2.15
-
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()
-
getMDCCopy
public void getMDCCopy()
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.
-
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 benullif there is no such information.Note that the
Throwableobject contained within aThrowableInformationdoes not survive serialization.- Since:
- 1.1
-
getThrowableStrRep
public String[] getThrowableStrRep()
Return this event's throwable's string[] representaion.
-
getPropertyKeySet
public Set getPropertyKeySet()
-
getProperties
public Map getProperties()
-
-