Class 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.
    • Field Detail

      • JVM_START_TIME

        private static final long JVM_START_TIME
    • 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.
        Returns:
        the time when the JVM started.
      • initStartTime

        private static long initStartTime()
        Returns the result of ManagementFactory.getRuntimeMXBean().getStartTime(), or the current system time if JMX is not available.
      • getLocationInformation

        public LocationInfo getLocationInformation()
        Set the location information for this logging event. The collected information is cached for future use.
        Overrides:
        getLocationInformation in class LoggingEvent
        Returns:
        Always returns null.
      • getLevel

        public Level getLevel()
        Return the level of this event. Use this form instead of directly accessing the level field.
        Overrides:
        getLevel in class LoggingEvent
        Returns:
        Always returns null.
      • getLoggerName

        public java.lang.String getLoggerName()
        Return the name of the logger. Use this form instead of directly accessing the categoryName field.
        Overrides:
        getLoggerName in class LoggingEvent
        Returns:
        Always returns null.
      • getLogger

        public Category getLogger()
        Gets the logger of the event.
        Overrides:
        getLogger in class LoggingEvent
        Returns:
        Always returns null.
      • getMessage

        public java.lang.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 class LoggingEvent
        Returns:
        Always returns null.
      • getMDC

        public java.lang.Object getMDC​(java.lang.String key)
        Overrides:
        getMDC in class LoggingEvent
      • getMDCCopy

        public void getMDCCopy()
        Obtain a copy of this thread's MDC prior to serialization or asynchronous logging.
        Overrides:
        getMDCCopy in class LoggingEvent
      • 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.

        Overrides:
        getThrowableInformation in class LoggingEvent
        Returns:
        Always returns null.
        Since:
        1.1
      • getThrowableStrRep

        public java.lang.String[] getThrowableStrRep()
        Return this event's throwable's string[] representaion.
        Overrides:
        getThrowableStrRep in class LoggingEvent
        Returns:
        Always returns null.
      • getProperty

        public java.lang.String getProperty​(java.lang.String key)
        Overrides:
        getProperty in class LoggingEvent