Package adams.flow.standalone
Class LogEvent
-
- All Implemented Interfaces:
AdditionalInformationHandler
,CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingListener
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<Actor>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,VariablesInspectionHandler
,VariableChangeListener
,Actor
,ActorHandler
,DaemonEvent
,ErrorHandler
,Event
,Flushable
,MutableActorHandler
,Serializable
,Comparable
public class LogEvent extends AbstractMutableActorDaemonEvent<LogRecord,Object> implements MutableActorHandler, DaemonEvent, LoggingListener
Listens to the global log record handler and processes records that passed the specified filter(s).
This allows, for instance, the output of log messages into a log file.
By default, log records are only processed if the sub-actors are not currently being executed. In other words, log records will get dropped if the record processing takes longer than the record generation. Enable the 'noDiscard' property to process all log events - NB: this can slow down the system significantly.
Valid options are:
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: LogEvent
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow gets stopped in case this actor encounters an error; useful for critical actors. default: false
-filter <adams.flow.standalone.logevent.AbstractLogRecordFilter> (property: filter) The filter used for selecting log records for processing. default: adams.flow.standalone.logevent.AcceptAllFilter
-processor <adams.flow.standalone.logevent.AbstractLogRecordProcessor> (property: processor) The processor used for turning the log record into a different format. default: adams.flow.standalone.logevent.SimpleProcessor
-no-discard <boolean> (property: noDiscard) If enabled, no log event gets discarded; CAUTION: enabling this option can slow down the system significantly. default: false
-actor <adams.flow.core.Actor> [-actor ...] (property: actors) The actors to process the output generated from the log record. default:
For more information on the schedule format, see CronTrigger Tutorial.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractLogRecordFilter
m_Filter
the log record filter.protected AbstractLogRecordProcessor
m_Processor
the log record processor.-
Fields inherited from class adams.flow.standalone.AbstractMutableActorDaemonEvent
BUSY, m_Actors, m_ExecutingActors, m_NoDiscard, NO_OUTPUT
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description LogEvent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
checkActors(Actor[] actors)
Checks the actors before they are set via the setActors method.void
defineOptions()
Adds options to the internal list of options.String
filterTipText()
Returns the tip text for this property.AbstractLogRecordFilter
getFilter()
Returns the record filter to use.AbstractLogRecordProcessor
getProcessor()
Returns the record processor to use.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.String
globalInfo()
Returns a string describing the object.protected boolean
handlesEvent(LogRecord e)
Checks whether the event is being handled.void
logEventOccurred(AbstractLogHandler source, LogRecord record)
Gets called in case of a log event.protected Object
preProcessEvent(LogRecord e)
Preprocesses the event.String
processorTipText()
Returns the tip text for this property.void
setFilter(AbstractLogRecordFilter value)
Sets the record filter to use.void
setProcessor(AbstractLogRecordProcessor value)
Sets the record processor to use.String
setUp()
Initializes the sub-actors for flow execution.protected boolean
usePreProcessedAsInput()
Returns whether the preprocessed event is used as input token.void
wrapUp()
Cleans up after the execution has finished.-
Methods inherited from class adams.flow.standalone.AbstractMutableActorDaemonEvent
active, actorsTipText, add, add, check, cleanUp, doExecute, firstActive, flushExecution, forceVariables, get, getActorHandlerInfo, getActors, getNoDiscard, indexOf, initialize, lastActive, noDiscardTipText, processEvent, remove, removeAll, set, setActors, setLoggingLevel, setNoDiscard, size, stopExecution, updateParent
-
Methods inherited from class adams.flow.standalone.AbstractStandalone
preExecute
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, pruneBackup, pruneBackup, reset, restoreState, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.flow.core.ActorHandler
check, firstActive, flushExecution, get, getActorHandlerInfo, indexOf, lastActive, set, size
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.flow.core.MutableActorHandler
add, add, remove, removeAll
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
m_Filter
protected AbstractLogRecordFilter m_Filter
the log record filter.
-
m_Processor
protected AbstractLogRecordProcessor m_Processor
the log record processor.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
-
checkActors
protected String checkActors(Actor[] actors)
Checks the actors before they are set via the setActors method. Returns an error message if the actors are not acceptable, null otherwise.- Specified by:
checkActors
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
- Parameters:
actors
- the actors to check- Returns:
- null if accepted, otherwise error message
-
setFilter
public void setFilter(AbstractLogRecordFilter value)
Sets the record filter to use.- Parameters:
value
- the filter
-
getFilter
public AbstractLogRecordFilter getFilter()
Returns the record filter to use.- Returns:
- the filter
-
filterTipText
public String filterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setProcessor
public void setProcessor(AbstractLogRecordProcessor value)
Sets the record processor to use.- Parameters:
value
- the processor
-
getProcessor
public AbstractLogRecordProcessor getProcessor()
Returns the record processor to use.- Returns:
- the processor
-
processorTipText
public String processorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceActor
- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractActor
- Returns:
- null if no info available, otherwise short string
-
handlesEvent
protected boolean handlesEvent(LogRecord e)
Checks whether the event is being handled.- Specified by:
handlesEvent
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
- Parameters:
e
- the event to check- Returns:
- true if being handled
-
preProcessEvent
protected Object preProcessEvent(LogRecord e)
Preprocesses the event.- Specified by:
preProcessEvent
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
- Parameters:
e
- the event to preprocess- Returns:
- the output of the preprocessing
-
usePreProcessedAsInput
protected boolean usePreProcessedAsInput()
Returns whether the preprocessed event is used as input token.- Specified by:
usePreProcessedAsInput
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
- Returns:
- true if used as input token
-
setUp
public String setUp()
Initializes the sub-actors for flow execution.- Specified by:
setUp
in interfaceActor
- Overrides:
setUp
in classAbstractMutableActorDaemonEvent<LogRecord,Object>
- Returns:
- null if everything is fine, otherwise error message
- See Also:
AbstractActor.reset()
-
logEventOccurred
public void logEventOccurred(AbstractLogHandler source, LogRecord record)
Gets called in case of a log event.- Specified by:
logEventOccurred
in interfaceLoggingListener
- Parameters:
source
- the handler that sent out the notificationrecord
- the record associated with the log event
-
-