Package org.apache.log4j.bridge
Class LogEventAdapter
java.lang.Object
org.apache.log4j.spi.LoggingEvent
org.apache.log4j.bridge.LogEventAdapter
Converts a Log4j 2 LogEvent into the components needed by a Log4j 1.x LoggingEvent.
This class requires Log4j 2.
-
Field Summary
FieldsFields inherited from class org.apache.log4j.spi.LoggingEvent
timeStamp
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetEvent()
getLevel()
Return the level of this event.Set the location information for this logging event.Gets the logger of the event.Return the name of the logger.void
Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.Return the message for this logging event.getNDC()
getProperty
(String key) static long
Returns the time when the application started, in milliseconds elapsed since 01.01.1970.Returns the throwable information contained within this event.String[]
Return this event's throwable's string[] representaion.long
private static long
Returns the result ofManagementFactory.getRuntimeMXBean().getStartTime()
, or the current system time if JMX is not available.Methods inherited from class org.apache.log4j.spi.LoggingEvent
getFQNOfLoggerClass, removeProperty, setProperty
-
Field Details
-
JVM_START_TIME
private static final long JVM_START_TIME -
event
-
-
Constructor Details
-
LogEventAdapter
-
-
Method Details
-
getStartTime
public static long getStartTime()Returns the time when the application started, in milliseconds elapsed since 01.01.1970.- Returns:
- the time when the JVM started.
-
initStartTime
private static long initStartTime()Returns the result ofManagementFactory.getRuntimeMXBean().getStartTime()
, or the current system time if JMX is not available. -
getEvent
-
getLocationInformation
Set the location information for this logging event. The collected information is cached for future use.- Overrides:
getLocationInformation
in classLoggingEvent
- Returns:
- Always returns null.
-
getLevel
Return the level of this event. Use this form instead of directly accessing thelevel
field.- Overrides:
getLevel
in classLoggingEvent
- Returns:
- Always returns null.
-
getLoggerName
Return the name of the logger. Use this form instead of directly accessing thecategoryName
field.- Overrides:
getLoggerName
in classLoggingEvent
- Returns:
- Always returns null.
-
getTimeStamp
public long getTimeStamp()- Overrides:
getTimeStamp
in classLoggingEvent
-
getLogger
Gets the logger of the event.- Overrides:
getLogger
in classLoggingEvent
- Returns:
- Always returns null.
-
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
- Returns:
- Always returns null.
-
getNDC
- Overrides:
getNDC
in classLoggingEvent
-
getMDC
- 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
- Overrides:
getRenderedMessage
in classLoggingEvent
-
getThreadName
- Overrides:
getThreadName
in classLoggingEvent
-
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
- Returns:
- Always returns null.
- Since:
- 1.1
-
getThrowableStrRep
Return this event's throwable's string[] representaion.- Overrides:
getThrowableStrRep
in classLoggingEvent
- Returns:
- Always returns null.
-
getProperty
- Overrides:
getProperty
in classLoggingEvent
-
getPropertyKeySet
- Overrides:
getPropertyKeySet
in classLoggingEvent
-
getProperties
- Overrides:
getProperties
in classLoggingEvent
-