org.aitools.programd.interfaces
Class ConsoleStreamAppender

java.lang.Object
  extended by org.apache.log4j.AppenderSkeleton
      extended by org.apache.log4j.WriterAppender
          extended by org.aitools.programd.interfaces.ConsoleStreamAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class ConsoleStreamAppender
extends org.apache.log4j.WriterAppender

A ConsoleStreamAppender publishes any record it's passed to the given stream.

Since:
4.6
Author:
Noel Bush

Field Summary
private  boolean printStackTraces
          Whether to print stack traces for exceptions.
private  Shell shell
          A Shell to watch.
 
Fields inherited from class org.apache.log4j.WriterAppender
encoding, immediateFlush, qw
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
ConsoleStreamAppender()
          Creates a new ConsoleStreamAppender.
 
Method Summary
 void doAppend(org.apache.log4j.spi.LoggingEvent event)
          Publishes the given record, also to the shell if one is attached.
 boolean isWriterSet()
           
 void setPrintStackTraces(boolean value)
          Specifies whether or not to print stack traces for "caught" exceptions (for uncaught exceptions, see CoreSettings).
 void setWriter(java.io.OutputStream stream)
           
protected  void subAppend(org.apache.log4j.spi.LoggingEvent event)
          Overrides this method of the parent class so that it will not print stack traces if it isn't supposed to.
 void watch(Shell shellToWatch)
          Assigns the given Shell to this handler, to watch it.
 
Methods inherited from class org.apache.log4j.WriterAppender
activateOptions, append, close, closeWriter, createWriter, getEncoding, getImmediateFlush, checkEntryConditions, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, writeFooter, writeHeader
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, 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
 

Field Detail

shell

private Shell shell
A Shell to watch.


printStackTraces

private boolean printStackTraces
Whether to print stack traces for exceptions.

Constructor Detail

ConsoleStreamAppender

public ConsoleStreamAppender()
Creates a new ConsoleStreamAppender.

Method Detail

watch

public void watch(Shell shellToWatch)
Assigns the given Shell to this handler, to watch it.

Parameters:
shellToWatch -

doAppend

public void doAppend(org.apache.log4j.spi.LoggingEvent event)
Publishes the given record, also to the shell if one is attached.

Specified by:
doAppend in interface org.apache.log4j.Appender
Overrides:
doAppend in class org.apache.log4j.AppenderSkeleton

setPrintStackTraces

public void setPrintStackTraces(boolean value)
Specifies whether or not to print stack traces for "caught" exceptions (for uncaught exceptions, see CoreSettings).

Parameters:
value - whether or not to print stack traces for "caught" exceptions

subAppend

protected void subAppend(org.apache.log4j.spi.LoggingEvent event)
Overrides this method of the parent class so that it will not print stack traces if it isn't supposed to.

Overrides:
subAppend in class org.apache.log4j.WriterAppender
See Also:
WriterAppender.subAppend(org.apache.log4j.spi.LoggingEvent)

setWriter

public void setWriter(java.io.OutputStream stream)

isWriterSet

public boolean isWriterSet()
Returns:
whether the writer has been set