edu.mit.util
Class DocumentAppender

java.lang.Object
  |
  +--org.apache.log4j.AppenderSkeleton
        |
        +--edu.mit.util.DocumentAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class DocumentAppender
extends org.apache.log4j.AppenderSkeleton


Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
DocumentAppender()
          This default constructor does nothing.
DocumentAppender(org.apache.log4j.Layout layout)
          Instantiate a DocumentAppender and send output to the given Document object.
DocumentAppender(org.apache.log4j.Layout layout, Document document)
          Instantiate a DocumentAppender and set the output destination to Document.
 
Method Summary
 void activateOptions()
          Does nothing.
 void append(org.apache.log4j.spi.LoggingEvent event)
          This method is called by the AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) method.
protected  boolean checkEntryConditions()
          This method determines if there is a sense in attempting to append.
 void close()
          Close this appender instance.
protected  void insert(String text)
           
 boolean requiresLayout()
          The WriterAppender requires a layout.
 void setErrorHandler(org.apache.log4j.spi.ErrorHandler eh)
          Set the ErrorHandler for this WriterAppender and also the underlying QuietWriter if any.
protected  void subAppend(org.apache.log4j.spi.LoggingEvent event)
          Actual writing occurs here.
protected  void writeFooter()
          Write a footer as produced by the embedded layout's Layout.getFooter() method.
protected  void writeHeader()
          Write a header as produced by the embedded layout's Layout.getHeader() method.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentAppender

public DocumentAppender()
This default constructor does nothing.

DocumentAppender

public DocumentAppender(org.apache.log4j.Layout layout)
Instantiate a DocumentAppender and send output to the given Document object.

DocumentAppender

public DocumentAppender(org.apache.log4j.Layout layout,
                        Document document)
Instantiate a DocumentAppender and set the output destination to Document.
Method Detail

activateOptions

public void activateOptions()
Does nothing.
Overrides:
activateOptions in class org.apache.log4j.AppenderSkeleton

append

public void append(org.apache.log4j.spi.LoggingEvent event)
This method is called by the AppenderSkeleton.doAppend(org.apache.log4j.spi.LoggingEvent) method.

The format of the output will depend on this appender's layout.

Overrides:
append in class org.apache.log4j.AppenderSkeleton

checkEntryConditions

protected boolean checkEntryConditions()
This method determines if there is a sense in attempting to append.

It checks whether there is a set output target and also if there is a set layout. If these checks fail, then the boolean value false is returned.


close

public void close()
Close this appender instance. The underlying stream or writer is also closed.

Closed appenders cannot be reused.

Overrides:
close in class org.apache.log4j.AppenderSkeleton
Since:
0.8.4 *
See Also:
#setWriter

setErrorHandler

public void setErrorHandler(org.apache.log4j.spi.ErrorHandler eh)
Set the ErrorHandler for this WriterAppender and also the underlying QuietWriter if any.
Overrides:
setErrorHandler in class org.apache.log4j.AppenderSkeleton

subAppend

protected void subAppend(org.apache.log4j.spi.LoggingEvent event)
Actual writing occurs here.

Most subclasses of WriterAppender will need to override this method.


requiresLayout

public boolean requiresLayout()
The WriterAppender requires a layout. Hence, this method returns true.
Overrides:
requiresLayout in class org.apache.log4j.AppenderSkeleton

writeFooter

protected void writeFooter()
Write a footer as produced by the embedded layout's Layout.getFooter() method.

writeHeader

protected void writeHeader()
Write a header as produced by the embedded layout's Layout.getHeader() method.

insert

protected void insert(String text)