public class MemoryAppender extends AppenderSkeleton
Modifier and Type | Field and Description |
---|---|
private static long |
__LOG_EXPIRATION_TIME
Time of expiration of a log (10 minutes)
|
private static long |
__TIME_DURATION_BEFORE_NEXT_CLEAN
Time duration between 2 cleansing of logs queue (10 seconds)
|
private long |
_lastCleanTime |
private LinkedList<MemoryLogRecord> |
_logsQueue |
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
Constructor and Description |
---|
MemoryAppender()
Default constructor for the memory appender
|
Modifier and Type | Method and Description |
---|---|
private boolean |
_matchCategoryFilter(List<String> filterCategories,
MemoryLogRecord record) |
protected void |
append(LoggingEvent event) |
void |
close() |
List<MemoryLogRecord> |
getEvents(long fromTimestamp)
Get the logs from a given timestamp
|
List<MemoryLogRecord> |
getEvents(long fromTimestamp,
List<String> filterCategories)
Get the logs from a given timestamp and filtered by specific categories
|
void |
removeExpiredEvents(long from)
Remove the expired log records every 10 seconds
|
boolean |
requiresLayout() |
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
private static final long __LOG_EXPIRATION_TIME
private static final long __TIME_DURATION_BEFORE_NEXT_CLEAN
private long _lastCleanTime
private LinkedList<MemoryLogRecord> _logsQueue
public MemoryAppender()
protected void append(LoggingEvent event)
append
in class AppenderSkeleton
public List<MemoryLogRecord> getEvents(long fromTimestamp)
fromTimestamp
- If greater than 0, get the events more recent than this timestamp parameter. If equals or less than 0, returns all eventspublic List<MemoryLogRecord> getEvents(long fromTimestamp, List<String> filterCategories)
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 categoriesprivate boolean _matchCategoryFilter(List<String> filterCategories, MemoryLogRecord record)
public void removeExpiredEvents(long from)
from
- The expiration date in millisecondspublic boolean requiresLayout()
public void close()