Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.hunsicker.jalopy.plugin
Class AbstractAppender  view AbstractAppender download AbstractAppender.java

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 $

Field Summary
private  org.apache.oro.text.regex.PatternMatcher _matcher
          Matcher instance.
private static java.lang.String APPENDER_NAME
          Name of the appender for output messages.
private static java.lang.String PATTERN
          Regex to apply for Emacs-style messages.
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()
          null
 void close()
          null
 void done()
          null
 org.apache.oro.text.regex.MatchResult parseMessage(org.apache.log4j.spi.LoggingEvent ev)
          Parses the given message.
 boolean requiresLayout()
          null
 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

APPENDER_NAME

private static final java.lang.String APPENDER_NAME
Name of the appender for output messages.

See Also:
Constant Field Values

PATTERN

private static final java.lang.String PATTERN
Regex to apply for Emacs-style messages. Messages must comply to the filename:line:column:text pattern.

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.


_matcher

private org.apache.oro.text.regex.PatternMatcher _matcher
Matcher instance.

Constructor Detail

AbstractAppender

public AbstractAppender()
Creates a new AbstractAppender object.

Method Detail

append

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


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

close

public void close()
null

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

done

public void done()
null

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);
     ...
 }
 


requiresLayout

public boolean requiresLayout()
null

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

checkEntryConditions

protected boolean checkEntryConditions()
null