Package org.apache.log4j.chainsaw
Class ChainsawAppenderHandler
java.lang.Object
org.apache.log4j.AppenderSkeleton
org.apache.log4j.chainsaw.ChainsawAppenderHandler
- All Implemented Interfaces:
org.apache.log4j.Appender
,org.apache.log4j.spi.OptionHandler
public class ChainsawAppenderHandler
extends org.apache.log4j.AppenderSkeleton
A handler class that either extends a particular appender hierarchy or can be
bound into the Log4j appender framework, and queues events, to be later
dispatched to registered/interested parties.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Queue of Events are placed in here, which are picked up by an asychronous thread. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private static final String
private String
private EventListenerList
private final Object
private PropertyChangeSupport
private final org.apache.log4j.spi.LoggingEventFieldResolver
private int
NOTE: This variable needs to be physically located LAST, because of the initialization sequence, the WorkQueue constructor starts a thread which ends up needing some reference to fields created in ChainsawAppenderHandler (outer instance) which may not have been created yet.Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCustomEventBatchListener
(String identifier, EventBatchListener l) void
void
void
addPropertyChangeListener
(String propertyName, PropertyChangeListener listener) void
append
(org.apache.log4j.spi.LoggingEvent event) void
close()
double
Exposes the current Data rate calculated.int
(package private) String
getTabIdentifier
(org.apache.log4j.spi.LoggingEvent e) Determines an appropriate title for the Tab for the Tab Pane by locating a the hostname propertyvoid
void
void
removePropertyChangeListener
(String propertyName, PropertyChangeListener listener) boolean
(package private) void
setDataRate
(double dataRate) void
setIdentifierExpression
(String identifierExpression) void
setQueueInterval
(int interval) Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
-
Field Details
-
DEFAULT_IDENTIFIER
- See Also:
-
mutex
-
sleepInterval
private int sleepInterval -
listenerList
-
dataRate
private double dataRate -
identifierExpression
-
resolver
private final org.apache.log4j.spi.LoggingEventFieldResolver resolver -
propertySupport
-
customExpressionRules
-
worker
NOTE: This variable needs to be physically located LAST, because of the initialization sequence, the WorkQueue constructor starts a thread which ends up needing some reference to fields created in ChainsawAppenderHandler (outer instance) which may not have been created yet. Becomes a race condition, and therefore this field initialization should be kept last.
-
-
Constructor Details
-
ChainsawAppenderHandler
-
ChainsawAppenderHandler
public ChainsawAppenderHandler()
-
-
Method Details
-
setIdentifierExpression
-
getIdentifierExpression
-
addCustomEventBatchListener
public void addCustomEventBatchListener(String identifier, EventBatchListener l) throws IllegalArgumentException - Throws:
IllegalArgumentException
-
addEventBatchListener
-
removeEventBatchListener
-
append
public void append(org.apache.log4j.spi.LoggingEvent event) - Specified by:
append
in classorg.apache.log4j.AppenderSkeleton
-
close
public void close() -
requiresLayout
public boolean requiresLayout() -
getQueueInterval
public int getQueueInterval() -
setQueueInterval
public void setQueueInterval(int interval) -
getTabIdentifier
Determines an appropriate title for the Tab for the Tab Pane by locating a the hostname property- Parameters:
e
-- Returns:
- identifier
-
getDataRate
public double getDataRate()Exposes the current Data rate calculated. This is periodically updated by an internal Thread as is the number of events that have been processed, and dispatched to all listeners since the last sample period divided by the number of seconds since the last sample period.This method fires a PropertyChange event so listeners can monitor the rate
- Returns:
- double # of events processed per second
-
setDataRate
void setDataRate(double dataRate) - Parameters:
dataRate
-
-
addPropertyChangeListener
- Parameters:
listener
-
-
addPropertyChangeListener
- Parameters:
propertyName
-listener
-
-
removePropertyChangeListener
- Parameters:
listener
-
-
removePropertyChangeListener
- Parameters:
propertyName
-listener
-
-