Jalopy 1.0b11

de.hunsicker.jalopy.plugin
Class AbstractAppender

java.lang.Object
  extended byorg.apache.log4j.AppenderSkeleton
      extended byde.hunsicker.jalopy.plugin.AbstractAppender
All Implemented Interfaces:
org.apache.log4j.Appender, org.apache.log4j.spi.OptionHandler, SwingAppender

public abstract class AbstractAppender
extends org.apache.log4j.AppenderSkeleton
implements SwingAppender

Skeleton implementation of an appender which outputs messages in a visual component.

Version:
$Revision: 1.4 $
Author:
Marco Hunsicker

Field Summary
static int POS_COLUMN
          Position of the message text in the regex result.
static int POS_FILENAME
          Position of the filename in the regex result.
static int POS_LINE
          Position of the lineno in the regex result.
static int POS_TEXT
          Position of the message text in the regex result.
protected  org.apache.oro.text.regex.Pattern regex
          The regex to parse the messages.
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
AbstractAppender()
          Creates a new AbstractAppender object.
 
Method Summary
abstract  void append(org.apache.log4j.spi.LoggingEvent ev)
          Does the actual outputting.
protected  boolean checkEntryConditions()
          {@inheritDoc}
 void close()
          
 void done()
          Notifies the appender that a run was finished.
 org.apache.oro.text.regex.MatchResult parseMessage(org.apache.log4j.spi.LoggingEvent ev)
          Parses the given message.
 boolean requiresLayout()
          
 void setName(java.lang.String name)
          Sets the name of the appender.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.hunsicker.jalopy.plugin.SwingAppender
clear
 
Methods inherited from interface org.apache.log4j.Appender
addFilter, clearFilters, doAppend, getErrorHandler, getFilter, getLayout, getName, setErrorHandler, setLayout
 

Field Detail

POS_FILENAME

public static final int POS_FILENAME
Position of the filename in the regex result.

See Also:
Constant Field Values

POS_LINE

public static final int POS_LINE
Position of the lineno in the regex result.

See Also:
Constant Field Values

POS_TEXT

public static final int POS_TEXT
Position of the message text in the regex result.

See Also:
Constant Field Values

POS_COLUMN

public static final int POS_COLUMN
Position of the message text in the regex result.

See Also:
Constant Field Values

regex

protected final org.apache.oro.text.regex.Pattern regex
The regex to parse the messages. If messages have a format similiar to Emacs messages (filename:lineno:text) the pattern will match.

Constructor Detail

AbstractAppender

public AbstractAppender()
Creates a new AbstractAppender object.

Throws:
ChainingRuntimeException - DOCUMENT ME!
Method Detail

append

public abstract void append(org.apache.log4j.spi.LoggingEvent ev)
Does the actual outputting.

Parameters:
ev - logging event.

setName

public final void setName(java.lang.String name)
Sets the name of the appender. Overidden so that the initial name can't be changed.

Specified by:
setName in interface org.apache.log4j.Appender
Parameters:
name - appender name (ignored).

close

public void close()

Specified by:
close in interface org.apache.log4j.Appender

done

public void done()
Notifies the appender that a run was finished.

Specified by:
done in interface SwingAppender

parseMessage

public org.apache.oro.text.regex.MatchResult parseMessage(org.apache.log4j.spi.LoggingEvent ev)
Parses the given message. To access the parsed information one may typically use:
 MatchResult result = parseMessage(message);
 if (result == null)
 {
     // handle plain message
     ...
 }
 else
 {
     // this is an Emacs style message, you can easily access the
     // information
     String filename = result.group(POS_FILENAME);
     String line = result.group(POS_LINE);
     String column = result.group(POS_COLUMN);
     String text = result.group(POS_TEXT);
     ...
 }
 

Parameters:
ev - logging event.
Returns:
parsing result. Returns null if the message doesn't match the Emacs format filename:line:column:text.

requiresLayout

public boolean requiresLayout()

Specified by:
requiresLayout in interface org.apache.log4j.Appender
Returns:
always true.

checkEntryConditions

protected boolean checkEntryConditions()
{@inheritDoc}

Returns:
always true.

Jalopy 1.0b11

Submit a bug or feature.

For further information and documentation, visit the official Jalopy website.
This page generated: June 17 2006