junit.log4j
Class JUnitAppender

java.lang.Object
  |
  +--junit.log4j.JUnitAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

public class JUnitAppender
extends java.lang.Object
implements org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler

Appender that joins JUnit and Log4J.

Created: Mon Nov 12 07:49:22 2001

Version:
$Revision: 1.2 $
Author:
Wolfgang Reissenberger

Field Summary
protected  org.apache.log4j.spi.Filter headFilter
          The first filter in the filter chain.
protected  org.apache.log4j.spi.Filter tailFilter
          The last filter in the filter chain.
 
Constructor Summary
JUnitAppender()
          Creates a new JUnitAppender instance.
 
Method Summary
 void activateOptions()
          Does nothing, since this class has no specific options.
 void addFilter(org.apache.log4j.spi.Filter newFilter)
          Add a filter to end of the filter list.
protected  void append(org.apache.log4j.spi.LoggingEvent event)
          Sends the event to the connector.
 void clearFilters()
          Clear the filters chain.
 void close()
          Release any resources allocated within the appender.
 void doAppend(org.apache.log4j.spi.LoggingEvent event)
          Filter the event using the current filters.
 org.apache.log4j.spi.ErrorHandler getErrorHandler()
          Get the value of errorHandler.
 org.apache.log4j.spi.Filter getFilter()
          Returns the head Filter.
 org.apache.log4j.Layout getLayout()
          Get the value of layout.
 java.lang.String getName()
          Get the value of name.
 java.lang.String[] getOptionStrings()
          Deprecated. Use the getter method for the option directly instead
 boolean requiresLayout()
          Yes, this appender requires a layout.
 void setErrorHandler(org.apache.log4j.spi.ErrorHandler v)
          Set the value of errorHandler.
 void setLayout(org.apache.log4j.Layout v)
          Set the value of layout.
 void setName(java.lang.String v)
          Set the value of name.
 void setOption(java.lang.String key, java.lang.String value)
          Deprecated. Use the setter method for the option directly instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

headFilter

protected org.apache.log4j.spi.Filter headFilter
The first filter in the filter chain. Set to null initially.

tailFilter

protected org.apache.log4j.spi.Filter tailFilter
The last filter in the filter chain.
Constructor Detail

JUnitAppender

public JUnitAppender()
Creates a new JUnitAppender instance.
Method Detail

getName

public java.lang.String getName()
Get the value of name.
Specified by:
getName in interface org.apache.log4j.Appender
Returns:
value of name.

setName

public void setName(java.lang.String v)
Set the value of name.
Specified by:
setName in interface org.apache.log4j.Appender
Parameters:
v - Value to assign to name.

close

public void close()
Release any resources allocated within the appender. Currently does nothing.
Specified by:
close in interface org.apache.log4j.Appender

addFilter

public void addFilter(org.apache.log4j.spi.Filter newFilter)
Add a filter to end of the filter list.
Specified by:
addFilter in interface org.apache.log4j.Appender
Parameters:
newFilter - new filter to be added

getFilter

public org.apache.log4j.spi.Filter getFilter()
Returns the head Filter.
Specified by:
getFilter in interface org.apache.log4j.Appender
Returns:
the head Filter

clearFilters

public void clearFilters()
Clear the filters chain.
Specified by:
clearFilters in interface org.apache.log4j.Appender

doAppend

public void doAppend(org.apache.log4j.spi.LoggingEvent event)
Filter the event using the current filters. If there exists an accepting filter or none in the sequence denies the event, it is appended.
Specified by:
doAppend in interface org.apache.log4j.Appender
Parameters:
event - a value of type 'LoggingEvent'

getErrorHandler

public org.apache.log4j.spi.ErrorHandler getErrorHandler()
Get the value of errorHandler.
Specified by:
getErrorHandler in interface org.apache.log4j.Appender
Returns:
value of errorHandler.

setErrorHandler

public void setErrorHandler(org.apache.log4j.spi.ErrorHandler v)
Set the value of errorHandler.
Specified by:
setErrorHandler in interface org.apache.log4j.Appender
Parameters:
v - Value to assign to errorHandler.

getLayout

public org.apache.log4j.Layout getLayout()
Get the value of layout.
Specified by:
getLayout in interface org.apache.log4j.Appender
Returns:
value of layout.

setLayout

public void setLayout(org.apache.log4j.Layout v)
Set the value of layout.
Specified by:
setLayout in interface org.apache.log4j.Appender
Parameters:
v - Value to assign to layout.

requiresLayout

public boolean requiresLayout()
Yes, this appender requires a layout.
Specified by:
requiresLayout in interface org.apache.log4j.Appender
Returns:
true

append

protected void append(org.apache.log4j.spi.LoggingEvent event)
Sends the event to the connector.
Parameters:
event - a LoggingEvent value
See Also:
getLayout()

activateOptions

public void activateOptions()
Does nothing, since this class has no specific options.
Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler

getOptionStrings

public java.lang.String[] getOptionStrings()
Deprecated. Use the getter method for the option directly instead

Does nothing, since this class has no specific options.
Returns:
empty array

setOption

public void setOption(java.lang.String key,
                      java.lang.String value)
Deprecated. Use the setter method for the option directly instead

Does nothing, since this class has no specific options.
Parameters:
key - option key
value - option value


Copyright © 2000 -- 2003 openfuture.de. All Rights Reserved.