Project Wonder 2.0

er.extensions
Class ERXEOFAppender

java.lang.Object
  extended byorg.apache.log4j.AppenderSkeleton
      extended byer.extensions.ERXEOFAppender
All Implemented Interfaces:
Appender, OptionHandler

public class ERXEOFAppender
extends AppenderSkeleton

Basic log4j EOF Appender
Very basic appender, useful for logging events to a database using EOF. Manditory Fields:
LoggingEntity - Entity for creating logging events. The class mapped to this entity must implement the interface: ERXEOFLogEntryInterface Optional Fields:
BufferSize - Number of Events to catch before calling ec.saveChanges()


Field Summary
protected  int bufferSize
          holds the buffer size, defaults to -1
protected  boolean conditionsChecked
          holds the flag if all the conditions for logging have been checked
protected  int currentBufferSize
          holds the current buffer size, defaults to 1
protected  EOEditingContext ec
          holds a reference to the logging editing context
protected  String loggingEntity
          holds the logging entity name
 
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
 
Constructor Summary
ERXEOFAppender()
           
 
Method Summary
 void append(LoggingEvent event)
          Entry point for logging an event.
protected  boolean checkConditions()
          Used to determine if the system is ready to log events to the database.
 void close()
          Called to close the appender.
protected  EOEditingContext editingContext()
          Gets the editing context for logging events.
 int getBufferSize()
          Gets the buffer size.
 String getLoggingEntity()
          Gets the logging entity name.
 boolean requiresLayout()
          The EOF Appender does not require a layout
protected  boolean safeToCreateEditingContext()
          Determines if enough of the EOF stack has been setup that it is safe to create an editing context and log events to the database.
 void setBufferSize(int bufferSize)
          Sets the current buffer size.
 void setLoggingEntity(String name)
          Sets the logging entity name.
protected  void subAppend(LoggingEvent event)
          This is where the real logging happens.
 
Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

loggingEntity

protected String loggingEntity
holds the logging entity name


ec

protected EOEditingContext ec
holds a reference to the logging editing context


bufferSize

protected int bufferSize
holds the buffer size, defaults to -1


conditionsChecked

protected boolean conditionsChecked
holds the flag if all the conditions for logging have been checked


currentBufferSize

protected int currentBufferSize
holds the current buffer size, defaults to 1

Constructor Detail

ERXEOFAppender

public ERXEOFAppender()
Method Detail

requiresLayout

public boolean requiresLayout()
The EOF Appender does not require a layout

Returns:
false

close

public void close()
Called to close the appender.


getLoggingEntity

public String getLoggingEntity()
Gets the logging entity name.

Returns:
logging entity name.

setLoggingEntity

public void setLoggingEntity(String name)
Sets the logging entity name.

Parameters:
name - name of the logging entity

safeToCreateEditingContext

protected boolean safeToCreateEditingContext()
Determines if enough of the EOF stack has been setup that it is safe to create an editing context and log events to the database.

Returns:
if any cooperating object stores have been created

editingContext

protected EOEditingContext editingContext()
Gets the editing context for logging events. Will create one if one hasn't been created yet.

Returns:
editing context to log events to the database

getBufferSize

public int getBufferSize()
Gets the buffer size.


setBufferSize

public void setBufferSize(int bufferSize)
Sets the current buffer size. Must be set to a value greater than zero.

Parameters:
bufferSize - size of the buffer

checkConditions

protected boolean checkConditions()
Used to determine if the system is ready to log events to the database.

Returns:
if all of the conditions are satisfied

append

public void append(LoggingEvent event)
Entry point for logging an event. Reminder: the nesting of calls is: doAppend() - check threshold - filter - append(); - checkConditions(); - subAppend();

Parameters:
event - current logging event

subAppend

protected void subAppend(LoggingEvent event)
This is where the real logging happens.

Parameters:
event - current logging event

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.