Package adams.flow.execution
Class ExecutionLog
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,FlowExecutionListener
,Serializable
,Comparable
public class ExecutionLog extends AbstractFlowExecutionListener
Generates a trace file with all activity logged, uses stdout when the log file is pointing to a directory.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-stage <PreInput|PostInput|PreExecute|PostExecute|PreOutput|PostOutput> [-stage ...] (property: stages) The execution stages to log. default: PRE_EXECUTE
-log-file <adams.core.io.PlaceholderFile> (property: logFile) The log file to write to; uses stdout if pointing to a directory. default: ${CWD}
-output-tokens <boolean> (property: outputTokens) If enabled, a string representation of input tokens are output as well. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DateFormat
m_DateFormat
the date formatter to use.protected PlaceholderFile
m_LogFile
the file to write to.protected boolean
m_OutputTokens
whether to output any tokens as well.protected ExecutionStage[]
m_Stages
the stages to output.protected Set<ExecutionStage>
m_StagesSet
the actual stages.protected BufferedWriter
m_Writer
the file writer.-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListener
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description ExecutionLog()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
add(String origin, Actor actor, String msg, Token token)
Writes a message to the log file.void
defineOptions()
Adds options to the internal list of options.void
finishListening()
Gets called when the flow execution ends.PlaceholderFile
getLogFile()
Returns the log file.boolean
getOutputTokens()
Returns whether to output the string representation of input tokens as well.ExecutionStage[]
getStages()
Returns the stages to log.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
logFileTipText()
Returns the tip text for this property.String
outputTokensTipText()
Returns the tip text for this property.void
postExecute(Actor actor)
Gets called after the actor was executed.void
postInput(Actor actor)
Gets called after the actor received the token.void
postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.void
preExecute(Actor actor)
Gets called before the actor gets executed.void
preInput(Actor actor, Token token)
Gets called before the actor receives the token.void
preOutput(Actor actor)
Gets called before a token gets obtained from the actor.void
setLogFile(PlaceholderFile value)
Sets the log file.void
setOutputTokens(boolean value)
Sets whether to output the string representation of input tokens as well.void
setStages(ExecutionStage[] value)
Sets the stages to log.String
stagesTipText()
Returns the tip text for this property.void
startListening()
Gets called when the flow execution starts.-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
cleanUp, compareTo, equals, getListeners, getOwner, setOwner, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Stages
protected ExecutionStage[] m_Stages
the stages to output.
-
m_LogFile
protected PlaceholderFile m_LogFile
the file to write to.
-
m_OutputTokens
protected boolean m_OutputTokens
whether to output any tokens as well.
-
m_Writer
protected BufferedWriter m_Writer
the file writer.
-
m_DateFormat
protected transient DateFormat m_DateFormat
the date formatter to use.
-
m_StagesSet
protected transient Set<ExecutionStage> m_StagesSet
the actual stages.
-
-
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 classAbstractOptionHandler
-
setStages
public void setStages(ExecutionStage[] value)
Sets the stages to log.- Parameters:
value
- the stages
-
getStages
public ExecutionStage[] getStages()
Returns the stages to log.- Returns:
- the stages
-
stagesTipText
public String stagesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLogFile
public void setLogFile(PlaceholderFile value)
Sets the log file.- Parameters:
value
- the file
-
getLogFile
public PlaceholderFile getLogFile()
Returns the log file.- Returns:
- the file
-
logFileTipText
public String logFileTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputTokens
public void setOutputTokens(boolean value)
Sets whether to output the string representation of input tokens as well.- Parameters:
value
- true if to output
-
getOutputTokens
public boolean getOutputTokens()
Returns whether to output the string representation of input tokens as well.- Returns:
- true if output
-
outputTokensTipText
public String outputTokensTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListening
in interfaceFlowExecutionListener
- Overrides:
startListening
in classAbstractFlowExecutionListener
-
add
protected void add(String origin, Actor actor, String msg, Token token)
Writes a message to the log file.- Parameters:
origin
- the origin, e.g., preInputactor
- the actor this message is formsg
- the actual messagetoken
- the token, can be null
-
preInput
public void preInput(Actor actor, Token token)
Gets called before the actor receives the token.- Specified by:
preInput
in interfaceFlowExecutionListener
- Overrides:
preInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will receive the tokentoken
- the token that the actor will receive
-
postInput
public void postInput(Actor actor)
Gets called after the actor received the token.- Specified by:
postInput
in interfaceFlowExecutionListener
- Overrides:
postInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that received the token
-
preExecute
public void preExecute(Actor actor)
Gets called before the actor gets executed.- Specified by:
preExecute
in interfaceFlowExecutionListener
- Overrides:
preExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will get executed
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecute
in interfaceFlowExecutionListener
- Overrides:
postExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that was executed
-
preOutput
public void preOutput(Actor actor)
Gets called before a token gets obtained from the actor.- Specified by:
preOutput
in interfaceFlowExecutionListener
- Overrides:
preOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor the token gets obtained from
-
postOutput
public void postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.- Specified by:
postOutput
in interfaceFlowExecutionListener
- Overrides:
postOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that the token was acquired fromtoken
- the token that was acquired from the actor
-
finishListening
public void finishListening()
Gets called when the flow execution ends.- Specified by:
finishListening
in interfaceFlowExecutionListener
- Overrides:
finishListening
in classAbstractFlowExecutionListener
-
-