etm.contrib.aggregation.log
Class AbstractLogAggregator

java.lang.Object
  extended by etm.contrib.aggregation.log.AbstractLogAggregator
All Implemented Interfaces:
Aggregator
Direct Known Subclasses:
CommonsLoggingAggregator, Jdk14LogAggregator, Log4jAggregator

public abstract class AbstractLogAggregator
extends java.lang.Object
implements Aggregator

Sometimes it is important to have access to raw measurement results. This base class wrap an existing aggregator and dumps all EtmPoints to a certain logging implementation using a common log format. Before dumping the measurement poin the nested aggregator Aggregator.add(etm.core.monitor.EtmPoint) method is called.

Logger implementations will use the default logger name DEFAULT_LOG_NAME unless this name was altered using setLogName(String).

A EtmPoint will logged using the DefaultOutputFormatter. You may override the default implementation by using setFormatter(etm.contrib.aggregation.log.LogOutputFormatter).

Due to the direct performance impact this aggregator should be used in conjunction with a time based buffered aggregator, such as BufferedTimedAggregator. Therefore a logging aggregator chain should look like this: BufferedTimedAggregator -> Implementation of AbstractLogAggregator -> (Flat/Nested)Aggregator. Be aware that log timestamps and measurement timestamps may be out of synch due to buffering.

Version:
$Revision: 195 $
Author:
void.fm

Field Summary
protected  EtmMonitorContext ctx
           
protected static java.lang.String DEFAULT_LOG_NAME
           
protected  Aggregator delegate
           
protected  EtmFilter filter
           
protected  LogOutputFormatter formatter
           
protected  java.lang.String logName
           
 
Constructor Summary
protected AbstractLogAggregator(Aggregator aAggregator)
           
 
Method Summary
 void add(EtmPoint point)
          Adds a new EtmPoint to the aggregator.
 void flush()
          Flushes the current aggregation details.
 void init(EtmMonitorContext aCtx)
          Lifecycle Method, will be called before Aggregator.start(), after initalization of the current EtmMonitor runtime.
protected abstract  void logMeasurement(EtmPoint aPoint)
          Logs a raw measurement result.
 void render(MeasurementRenderer renderer)
          Renders the current state of the aggregator using the provided renderer instance.
 void reset()
          Resets the internal aggregator state.
 void reset(java.lang.String symbolicName)
          Resets the internal aggregator state for a etm point.
 void setFilterPattern(java.lang.String matchingPattern)
          Adds a filter for symbolic EtmPoint names that should be logged.
 void setFormatter(LogOutputFormatter aFormatter)
          Overrides the default log output formatter.
 void setFormatterClass(java.lang.Class aFormatterClazz)
           
 void setLogName(java.lang.String aLogName)
          Overrides the default logger name.
 void start()
          Lifecycle method, will be called after all Aggregator instances are initialized by calling Aggregator.init(etm.core.monitor.EtmMonitorContext) and before the EtmMonitor instance will becomes available.
 void stop()
          Lifecycle method, will be called after the EtmMonitor instance was shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface etm.core.aggregation.Aggregator
getMetaData
 

Field Detail

DEFAULT_LOG_NAME

protected static final java.lang.String DEFAULT_LOG_NAME
See Also:
Constant Field Values

delegate

protected Aggregator delegate

logName

protected java.lang.String logName

formatter

protected LogOutputFormatter formatter

filter

protected EtmFilter filter

ctx

protected EtmMonitorContext ctx
Constructor Detail

AbstractLogAggregator

protected AbstractLogAggregator(Aggregator aAggregator)
Method Detail

setLogName

public void setLogName(java.lang.String aLogName)
Overrides the default logger name. Make sure to call this method before starting the EtmMonitor, otherwhise changes will be unaffected.

Parameters:
aLogName - The new name of the logger.

setFormatter

public void setFormatter(LogOutputFormatter aFormatter)
Overrides the default log output formatter. Make sure to call this method before starting the EtmMonitor, otherwhise changes will be unaffected.

Parameters:
aFormatter - A new formatter.

setFormatterClass

public void setFormatterClass(java.lang.Class aFormatterClazz)

setFilterPattern

public void setFilterPattern(java.lang.String matchingPattern)
Adds a filter for symbolic EtmPoint names that should be logged. Uses Pattern for pattern matching. Multiple pattern may be supplied separated by a ";". Requires JDK 1.4 or higher.

Parameters:
matchingPattern - One or more pattern, separated by ;
See Also:
RegexEtmFilter

add

public void add(EtmPoint point)
Description copied from interface: Aggregator
Adds a new EtmPoint to the aggregator.

Specified by:
add in interface Aggregator
Parameters:
point - A new collected EtmPoint.

flush

public void flush()
Description copied from interface: Aggregator
Flushes the current aggregation details. Buffering Aggragetors should clean up their process buffer.

Specified by:
flush in interface Aggregator

reset

public void reset()
Description copied from interface: Aggregator
Resets the internal aggregator state. Persistent states usually aren't affected.

Specified by:
reset in interface Aggregator

reset

public void reset(java.lang.String symbolicName)
Description copied from interface: Aggregator
Resets the internal aggregator state for a etm point. Persistent states usually aren't affected.

Specified by:
reset in interface Aggregator
Parameters:
symbolicName - The name of the etm point to be resetted.

render

public void render(MeasurementRenderer renderer)
Description copied from interface: Aggregator
Renders the current state of the aggregator using the provided renderer instance.

Specified by:
render in interface Aggregator
Parameters:
renderer - The renderer.

init

public void init(EtmMonitorContext aCtx)
Description copied from interface: Aggregator
Lifecycle Method, will be called before Aggregator.start(), after initalization of the current EtmMonitor runtime. Be aware that Plugins are instantiated, but not started at this point.

Specified by:
init in interface Aggregator
Parameters:
aCtx - The current EtmMonitor Context.

start

public void start()
Description copied from interface: Aggregator
Lifecycle method, will be called after all Aggregator instances are initialized by calling Aggregator.init(etm.core.monitor.EtmMonitorContext) and before the EtmMonitor instance will becomes available.

Specified by:
start in interface Aggregator

stop

public void stop()
Description copied from interface: Aggregator
Lifecycle method, will be called after the EtmMonitor instance was shutdown.

Specified by:
stop in interface Aggregator

logMeasurement

protected abstract void logMeasurement(EtmPoint aPoint)
Logs a raw measurement result.

Parameters:
aPoint - The point to be logged.


Copyright © 2004,2005, 2006, 2007 void.fm. All Rights Reserved.