Class MemoryAppender

java.lang.Object
org.apache.log4j.AppenderSkeleton
org.ametys.runtime.log.MemoryAppender
All Implemented Interfaces:
Appender, OptionHandler

public class MemoryAppender extends AppenderSkeleton
Log appender that stores a pile of logs in memory.
  • Constructor Details

    • MemoryAppender

      public MemoryAppender()
      Default constructor for the memory appender
  • Method Details

    • append

      protected void append(LoggingEvent event)
      Specified by:
      append in class AppenderSkeleton
    • getEvents

      public List<MemoryLogRecord> getEvents(long fromTimestamp)
      Get the logs from a given timestamp
      Parameters:
      fromTimestamp - If greater than 0, get the events more recent than this timestamp parameter. If equals or less than 0, returns all events
      Returns:
      The log events
    • getEvents

      public List<MemoryLogRecord> getEvents(long fromTimestamp, List<String> filterCategories)
      Get the logs from a given timestamp and filtered by specific categories
      Parameters:
      fromTimestamp - If greater than 0, get the events more recent than this timestamp parameter. If equals or less than 0, returns all events
      filterCategories - The filter categories
      Returns:
      The log events
    • removeExpiredEvents

      public void removeExpiredEvents(long from)
      Remove the expired log records every 10 seconds
      Parameters:
      from - The expiration date in milliseconds
    • requiresLayout

      public boolean requiresLayout()
    • close

      public void close()