org.apache.commons.monitoring.reporting
Class SelectorPeriodicLogger

java.lang.Object
  extended by java.util.TimerTask
      extended by org.apache.commons.monitoring.reporting.AbstractPeriodicLogger
          extended by org.apache.commons.monitoring.reporting.SelectorPeriodicLogger
All Implemented Interfaces:
java.lang.Runnable

public abstract class SelectorPeriodicLogger
extends AbstractPeriodicLogger

A periodic logger implementation that uses a set of selector to extract monitoring datas to log.

Typical use case is to produce a fixed format (CSV, Excel-like, tabular...) in a log file, with a new line for each period.

Author:
Nicolas De Loof

Constructor Summary
SelectorPeriodicLogger(int period, java.util.Date firstTime, Repository.Observable repository, java.util.List<java.lang.String> selectors)
           
SelectorPeriodicLogger(int period, java.util.Date firstTime, Repository.Observable repository, java.lang.String[] selectors)
           
 
Method Summary
protected abstract  void log(java.lang.Object[] values)
          Log the data extracted by selectors
protected  void log(SecondaryRepository period)
          Log the data from the (secondary) repository generated during the period
 
Methods inherited from class org.apache.commons.monitoring.reporting.AbstractPeriodicLogger
getRepositoryForActivePeriod, handleError, run, stop
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectorPeriodicLogger

public SelectorPeriodicLogger(int period,
                              java.util.Date firstTime,
                              Repository.Observable repository,
                              java.util.List<java.lang.String> selectors)
Parameters:
period - the period (in ms) to log the monitoring state
firstTime - the first time to log (may be null)
repository - the observed repository
output - the output file

SelectorPeriodicLogger

public SelectorPeriodicLogger(int period,
                              java.util.Date firstTime,
                              Repository.Observable repository,
                              java.lang.String[] selectors)
Parameters:
period - the period (in ms) to log the monitoring state
repository - the target monitoring repository
output - the output file
Method Detail

log

protected final void log(SecondaryRepository period)
                  throws java.io.IOException
Log the data from the (secondary) repository generated during the period

Specified by:
log in class AbstractPeriodicLogger
Parameters:
period - secondary repository that observed the monitored state during the last active period
Throws:
java.io.IOException

log

protected abstract void log(java.lang.Object[] values)
                     throws java.io.IOException
Log the data extracted by selectors

Parameters:
values - the data to log
Throws:
java.io.IOException - any I/O error during log


Copyright © 2008 The Apache Software Foundation. All Rights Reserved.