Package adams.console
Class Logging
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,Stoppable,StoppableWithFeedback,RemoteCommandProcessorHandler,Serializable
public class Logging extends AbstractConsoleApplication implements StoppableWithFeedback, RemoteCommandProcessorHandler
Allows to capture the logging of an ADAMS instance.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogging.RemoteListenerRunnableWithLogRunnable that outputs the log records to stdout.
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_PORTthe default port to use for receiving logging messages.protected RemoteCommandProcessorm_CommandProcessorthe command processor.protected BaseHostnamem_LocalHostthe local host/port to use.protected intm_MaxFailuresthe maximum number of connection failures to handle (-1 for indefinite).protected BaseHostnamem_RemoteHostthe remote host/port to connect to.protected booleanm_Stoppedwhether listening was stopped.-
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 Logging()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcommandProcessorTipText()Returns the tip text for this property.protected DefaultScriptingEngineconfigureEngine(int defPort)Returns new instance of a configured scripting engine.voiddefineOptions()Adds options to the internal list of options.protected Stringexecute()Executes the application.RemoteCommandProcessorgetCommandProcessor()Returns the command processor in use.BaseHostnamegetLocalHost()Returns the local host/port to send the log records to.intgetMaxFailures()Returns the maximum number of connection failures to tolerate.BaseHostnamegetRemoteHost()Returns the host to capture the logging from.StringglobalInfo()Returns a string describing the object.booleanisStopped()Whether the execution has been stopped.StringlocalHostTipText()Returns the tip text for this property.static voidmain(String[] args)Starts the terminal application from commandline.StringmaxFaiuresTipText()Returns the tip text for this property.StringremoteHostTipText()Returns the tip text for this property.StringsendCommandWithReponse(RemoteCommandWithResponse cmd, BaseHostname local, BaseHostname remote, int defPort)Sends the specified command and the response handler for intercepting the result.voidsetCommandProcessor(RemoteCommandProcessor value)Sets the command processor to use.voidsetLocalHost(BaseHostname value)Sets the local host/port to send the log records to.voidsetMaxFailures(int value)Sets the maximum number of conection failures to tolerate.voidsetRemoteHost(BaseHostname value)Sets the host to capture the logging from.voidstopExecution()Stops the execution.-
Methods inherited from class adams.console.AbstractConsoleApplication
forCommandLine, forName, runApplication
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
DEFAULT_PORT
public static final int DEFAULT_PORT
the default port to use for receiving logging messages.- See Also:
- Constant Field Values
-
m_RemoteHost
protected BaseHostname m_RemoteHost
the remote host/port to connect to.
-
m_LocalHost
protected BaseHostname m_LocalHost
the local host/port to use.
-
m_CommandProcessor
protected RemoteCommandProcessor m_CommandProcessor
the command processor.
-
m_MaxFailures
protected int m_MaxFailures
the maximum number of connection failures to handle (-1 for indefinite).
-
m_Stopped
protected boolean m_Stopped
whether listening was stopped.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setCommandProcessor
public void setCommandProcessor(RemoteCommandProcessor value)
Sets the command processor to use.- Specified by:
setCommandProcessorin interfaceRemoteCommandProcessorHandler- Parameters:
value- the processor
-
getCommandProcessor
public RemoteCommandProcessor getCommandProcessor()
Returns the command processor in use.- Specified by:
getCommandProcessorin interfaceRemoteCommandProcessorHandler- Returns:
- the processor
-
commandProcessorTipText
public String commandProcessorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setRemoteHost
public void setRemoteHost(BaseHostname value)
Sets the host to capture the logging from.- Parameters:
value- the host/port
-
getRemoteHost
public BaseHostname getRemoteHost()
Returns the host to capture the logging from.- Returns:
- the host/port
-
remoteHostTipText
public String remoteHostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLocalHost
public void setLocalHost(BaseHostname value)
Sets the local host/port to send the log records to.- Parameters:
value- the local host/port
-
getLocalHost
public BaseHostname getLocalHost()
Returns the local host/port to send the log records to.- Returns:
- the local host/port
-
localHostTipText
public String localHostTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxFailures
public void setMaxFailures(int value)
Sets the maximum number of conection failures to tolerate.- Parameters:
value- the maximum, -1 for indefinite
-
getMaxFailures
public int getMaxFailures()
Returns the maximum number of connection failures to tolerate.- Returns:
- the maximum, -1 for indefinite
-
maxFaiuresTipText
public String maxFaiuresTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
configureEngine
protected DefaultScriptingEngine configureEngine(int defPort)
Returns new instance of a configured scripting engine.- Parameters:
defPort- the default port to use- Returns:
- the engine
-
sendCommandWithReponse
public String sendCommandWithReponse(RemoteCommandWithResponse cmd, BaseHostname local, BaseHostname remote, int defPort)
Sends the specified command and the response handler for intercepting the result.- Parameters:
cmd- the command to sendlocal- the local hostremote- the remote hostdefPort- the default port to use
-
execute
protected String execute()
Executes the application.- Specified by:
executein classAbstractConsoleApplication- Returns:
- null if successful, otherwise error message
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStoppedin interfaceStoppableWithFeedback- Returns:
- true if stopped
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecutionin interfaceStoppable
-
-