Regain 2.1.0-STABLE API

net.sf.regain.util.io
Class MemoryAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by net.sf.regain.util.io.MemoryAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class MemoryAppender
extends org.apache.log4j.AppenderSkeleton

A Log4j appender that keeps a number of logging events in memory. These events may be layouted on demand.

Author:
Til Schneider, www.murfman.de

Field Summary
private  LinkedList mCache
          Holds the cached log messages.
private  int mMaxCacheSize
          The maximum cache size.
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
MemoryAppender()
          Creates a new MemoryAppender instance.
 
Method Summary
protected  void append(org.apache.log4j.spi.LoggingEvent evt)
           
 void close()
           
 void printLog(Printer printer)
          Prints the cached logging events to a page printer.
 boolean requiresLayout()
           
 void setMaxCacheSize(int maxCacheSize)
          Sets the maximum cache size.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCache

private LinkedList mCache
Holds the cached log messages.


mMaxCacheSize

private int mMaxCacheSize
The maximum cache size.

Constructor Detail

MemoryAppender

public MemoryAppender()
Creates a new MemoryAppender instance.

Method Detail

setMaxCacheSize

public void setMaxCacheSize(int maxCacheSize)
Sets the maximum cache size.

Parameters:
maxCacheSize - the maximum cache size.

printLog

public void printLog(Printer printer)
              throws RegainException
Prints the cached logging events to a page printer.

Parameters:
printer - The page printer to print to.
Throws:
RegainException - If printing failed.

append

protected void append(org.apache.log4j.spi.LoggingEvent evt)
Specified by:
append in class org.apache.log4j.AppenderSkeleton

close

public void close()
Specified by:
close in interface org.apache.log4j.Appender
Specified by:
close in class org.apache.log4j.AppenderSkeleton

requiresLayout

public boolean requiresLayout()
Specified by:
requiresLayout in interface org.apache.log4j.Appender
Specified by:
requiresLayout in class org.apache.log4j.AppenderSkeleton

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info