Package org.apache.log4j.bridge
Class LogEventAdapter
- java.lang.Object
-
- org.apache.log4j.spi.LoggingEvent
-
- org.apache.log4j.bridge.LogEventAdapter
-
public class LogEventAdapter extends LoggingEvent
Converts a Log4j 2 LogEvent into the components needed by a Log4j 1.x LoggingEvent. This class requires Log4j 2.
-
-
Constructor Summary
Constructors Constructor Description LogEventAdapter(LogEvent event)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description LogEvent
getEvent()
Level
getLevel()
Return the level of this event.LocationInfo
getLocationInformation()
Set the location information for this logging event.Category
getLogger()
Gets the logger of the event.String
getLoggerName()
Return the name of the logger.Object
getMDC(String key)
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()
Map
getProperties()
String
getProperty(String key)
Set
getPropertyKeySet()
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 org.apache.log4j.spi.LoggingEvent
getFQNOfLoggerClass, getTimeStamp, removeProperty, setProperty
-
-
-
-
Constructor Detail
-
LogEventAdapter
public LogEventAdapter(LogEvent event)
-
-
Method Detail
-
getStartTime
public static long getStartTime()
Returns the time when the application started, in milliseconds elapsed since 01.01.1970.
-
getEvent
public LogEvent getEvent()
-
getLocationInformation
public LocationInfo getLocationInformation()
Set the location information for this logging event. The collected information is cached for future use.- Overrides:
getLocationInformation
in classLoggingEvent
-
getLevel
public Level getLevel()
Return the level of this event. Use this form instead of directly accessing thelevel
field.- Overrides:
getLevel
in classLoggingEvent
-
getLoggerName
public String getLoggerName()
Return the name of the logger. Use this form instead of directly accessing thecategoryName
field.- Overrides:
getLoggerName
in classLoggingEvent
-
getLogger
public Category getLogger()
Gets the logger of the event.- Overrides:
getLogger
in classLoggingEvent
-
getMessage
public Object getMessage()
Description copied from class:LoggingEvent
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.
- Overrides:
getMessage
in classLoggingEvent
-
getNDC
public String getNDC()
- Overrides:
getNDC
in classLoggingEvent
-
getMDC
public Object getMDC(String key)
- Overrides:
getMDC
in classLoggingEvent
-
getMDCCopy
public void getMDCCopy()
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.- Overrides:
getMDCCopy
in classLoggingEvent
-
getRenderedMessage
public String getRenderedMessage()
- Overrides:
getRenderedMessage
in classLoggingEvent
-
getThreadName
public String getThreadName()
- Overrides:
getThreadName
in classLoggingEvent
-
getThrowableInformation
public ThrowableInformation getThrowableInformation()
Returns the throwable information contained within this event. May benull
if there is no such information.Note that the
Throwable
object contained within aThrowableInformation
does not survive serialization.- Overrides:
getThrowableInformation
in classLoggingEvent
- Since:
- 1.1
-
getThrowableStrRep
public String[] getThrowableStrRep()
Return this event's throwable's string[] representaion.- Overrides:
getThrowableStrRep
in classLoggingEvent
-
getProperty
public String getProperty(String key)
- Overrides:
getProperty
in classLoggingEvent
-
getPropertyKeySet
public Set getPropertyKeySet()
- Overrides:
getPropertyKeySet
in classLoggingEvent
-
getProperties
public Map getProperties()
- Overrides:
getProperties
in classLoggingEvent
-
-