Package org.ametys.runtime.log
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.
-
-
Field Summary
-
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
-
-
Constructor Summary
Constructors Constructor Description MemoryAppender()
Default constructor for the memory appender
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
append(LoggingEvent event)
void
close()
List<MemoryLogRecord>
getEvents(long fromTimestamp)
Get the logs from a given timestampList<MemoryLogRecord>
getEvents(long fromTimestamp, List<String> filterCategories)
Get the logs from a given timestamp and filtered by specific categoriesvoid
removeExpiredEvents(long from)
Remove the expired log records every 10 secondsboolean
requiresLayout()
-
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
-
-
-
-
Constructor Detail
-
MemoryAppender
public MemoryAppender()
Default constructor for the memory appender
-
-
Method Detail
-
append
protected void append(LoggingEvent event)
- Specified by:
append
in classAppenderSkeleton
-
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 eventsfilterCategories
- 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()
-
-