net.codesmarts.log4j
Class AbstractBugReportAppender

java.lang.Object
  extended byorg.apache.log4j.AppenderSkeleton
      extended bynet.codesmarts.log4j.AbstractBugReportAppender
All Implemented Interfaces:
org.apache.log4j.Appender, BugReportAppender, org.apache.log4j.spi.OptionHandler
Direct Known Subclasses:
AbstractEmailBugReportAppender, AbstractHttpBugReportAppender, FileSystemBugReportAppender

public abstract class AbstractBugReportAppender
extends org.apache.log4j.AppenderSkeleton
implements org.apache.log4j.spi.OptionHandler, BugReportAppender

Base class for BugReport Appenders

Author:
Fred McCann

Field Summary
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
AbstractBugReportAppender()
           
 
Method Summary
 void activateOptions()
           
abstract  void append(BugReport report)
          Append a bug report
protected  void append(org.apache.log4j.spi.LoggingEvent event)
          This method does nothing, use append(BugReport)
 void close()
           
 void doAppend(org.apache.log4j.spi.LoggingEvent event)
          Append an logging event
 java.lang.String getHashingMethod()
          Get the hash method specified by this appender
 int getHashMethod()
          Get the hash method specified by this appender
 int getMaxSize()
          The maximum number of logging events allowed in a single report.
 org.apache.log4j.Priority getThresholdPriority()
          The threshold priority is the priority required to generate a bug report.
 int getThresholdSize()
          For short running threads (like serlvet requets/reponse handlers), a log report is generated when the application thread dies.
abstract  void init()
          initialize appender (use this instead of activateOptions)
 boolean isReportDuplicates()
          This returns true if this appender is configured to file duplicate reports.
 boolean requiresLayout()
           
 void setHashingMethod(java.lang.String m)
          Set the hash method for creating semiunique keys.
 void setLayout(org.apache.log4j.Layout layout)
           
 void setMaxSize(int size)
          Set the maximum size of the log buffer
 void setReportDuplicates(boolean reportDuplicates)
          Set the flag to report duplicate Bug Reports
 void setThresholdPriority(org.apache.log4j.Priority thresholdPriority)
          Bug Reports are triggered when a logging event of this priority is detected
 void setThresholdSize(int size)
          Set the threadhold size of the event buffer
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
addFilter, clearFilters, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractBugReportAppender

public AbstractBugReportAppender()
Method Detail

getMaxSize

public int getMaxSize()
The maximum number of logging events allowed in a single report. Defaults to 200

Specified by:
getMaxSize in interface BugReportAppender
Returns:
Returns the _maxSize.

setMaxSize

public void setMaxSize(int size)
Set the maximum size of the log buffer

Parameters:
size - The _maxSize to set.

getThresholdPriority

public org.apache.log4j.Priority getThresholdPriority()
The threshold priority is the priority required to generate a bug report.

Specified by:
getThresholdPriority in interface BugReportAppender
Returns:
Returns the thresholdLevel.

setThresholdPriority

public void setThresholdPriority(org.apache.log4j.Priority thresholdPriority)
Bug Reports are triggered when a logging event of this priority is detected


getThresholdSize

public int getThresholdSize()
For short running threads (like serlvet requets/reponse handlers), a log report is generated when the application thread dies. For longer running threads, a threadhold size is used. If a watch thread wakes from sleep and there are events in the buffer at or greater than the threshold size and there is at least one event of sufficient priority level, a bug report is generated. This defaults to 100

Specified by:
getThresholdSize in interface BugReportAppender
Returns:
Returns the _thresholdSize.

setThresholdSize

public void setThresholdSize(int size)
Set the threadhold size of the event buffer

Parameters:
size - The _thresholdSize to set.

activateOptions

public final void activateOptions()
Specified by:
activateOptions in interface org.apache.log4j.spi.OptionHandler
See Also:
OptionHandler.activateOptions()

doAppend

public void doAppend(org.apache.log4j.spi.LoggingEvent event)
Append an logging event

Specified by:
doAppend in interface org.apache.log4j.Appender
See Also:
AppenderSkeleton.append(org.apache.log4j.spi.LoggingEvent)

append

public abstract void append(BugReport report)
Append a bug report

Specified by:
append in interface BugReportAppender

init

public abstract void init()
initialize appender (use this instead of activateOptions)


append

protected final void append(org.apache.log4j.spi.LoggingEvent event)
This method does nothing, use append(BugReport)


close

public void close()
Specified by:
close in interface org.apache.log4j.Appender
See Also:
Appender.close()

requiresLayout

public boolean requiresLayout()
Specified by:
requiresLayout in interface org.apache.log4j.Appender
See Also:
Appender.requiresLayout()

setLayout

public void setLayout(org.apache.log4j.Layout layout)
Specified by:
setLayout in interface org.apache.log4j.Appender
See Also:
Appender.setLayout(org.apache.log4j.Layout)

isReportDuplicates

public boolean isReportDuplicates()
This returns true if this appender is configured to file duplicate reports. This defaults to false

Specified by:
isReportDuplicates in interface BugReportAppender
Returns:
Returns the reportDuplicates.

setReportDuplicates

public void setReportDuplicates(boolean reportDuplicates)
Set the flag to report duplicate Bug Reports

Parameters:
reportDuplicates - The reportDuplicates to set.

setHashingMethod

public void setHashingMethod(java.lang.String m)
Set the hash method for creating semiunique keys. Valid options are: LOCATION, CONTENT, and THROWABLE. Defaults to LOCATION


getHashingMethod

public java.lang.String getHashingMethod()
Get the hash method specified by this appender

Returns:
Returns the _hashMethod.

getHashMethod

public int getHashMethod()
Get the hash method specified by this appender

Specified by:
getHashMethod in interface BugReportAppender
Returns:
Returns the _hashMethod.


Copyright © 2005 CodeSmarts. All Rights Reserved.