com.cometway.io
Class FileLoggerAgent
java.lang.Object
com.cometway.props.Props
com.cometway.ak.Agent
com.cometway.ak.ServiceAgent
com.cometway.io.FileLoggerAgent
- All Implemented Interfaces:
- AgentInterface, HasStateMachineModel
- Direct Known Subclasses:
- FileReporter
public class FileLoggerAgent
- extends ServiceAgent
This agent logs Strings to a time-stamped file.
|
Field Summary |
protected static java.lang.String |
EOL
|
protected int |
logCount
|
protected java.lang.Object |
logSync
|
protected java.io.BufferedWriter |
out
|
| Fields inherited from class com.cometway.ak.Agent |
agent_id, agentController, CREATING_STATE, debugReporter, DESTROYED_STATE, DESTROYING_STATE, errorReporter, FAILED_STATE, printlnReporter, props, RUNNING_STATE, STARTING_STATE, STOPPED_STATE, STOPPING_STATE, warningReporter |
|
Method Summary |
protected void |
closeLogFile()
Properly closes the currently open log file. |
protected void |
createLogFile()
Initializes log File / checks to see if matching file already exists. |
void |
initProps()
Initializes this agent's properties by providing default
values for each of the following missing properties:
"log_type" sets the type of log file to be used (default: FILE),
"log_file_prefix specifies the prefix for the log_file
(default: log_), "logs_per_file" specifies the maximum
log entries per file (default: 10000). |
void |
log(java.lang.String s)
Writes information given as a String input to log file. |
void |
start()
Creates new logSync object, creates the log file, and registers with the service manager. |
| Methods inherited from class com.cometway.ak.Agent |
currentStateEquals, debug, destroy, error, error, getAgentController, getDateTimeStr, getProps, getServiceImpl, getStateMachineModel, println, register, registerService, setAgentController, setProps, toString, unregister, unregisterService, warning, warning |
| Methods inherited from class com.cometway.props.Props |
addListener, append, copy, copyFrom, copyTo, decrementInteger, dump, enableListeners, enumerateKeys, format, getBoolean, getByteArray, getCharacter, getDate, getDate, getDateString, getDouble, getFloat, getHexString, getInteger, getKeys, getLong, getNextKey, getProperty, getProperty, getPropsContainer, getSize, getString, getString, getTokens, getTokens, getTrimmedString, getVector, hasProperty, incrementInteger, insertProps, loadProps, notifyPropsChanged, notifyPropsChangedIgnore, notifyPropsChangedIgnore, parse, propertyMatchesRegEx, readFromFile, regExPropertyMatches, removeAll, removeListener, removeProperty, resumeNotify, saveProps, set, setBoolean, setCharacter, setDefault, setDouble, setFloat, setInteger, setLong, setProperty, setProperty, setProperty, setPropsContainer, suspendNotify, writeToFile |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
EOL
protected static final java.lang.String EOL
logCount
protected int logCount
out
protected java.io.BufferedWriter out
logSync
protected java.lang.Object logSync
FileLoggerAgent
public FileLoggerAgent()
initProps
public void initProps()
- Initializes this agent's properties by providing default
values for each of the following missing properties:
"log_type" sets the type of log file to be used (default: FILE),
"log_file_prefix specifies the prefix for the log_file
(default: log_), "logs_per_file" specifies the maximum
log entries per file (default: 10000).
- Specified by:
initProps in interface AgentInterface- Overrides:
initProps in class Agent
start
public void start()
- Creates new logSync object, creates the log file, and registers with the service manager.
- Specified by:
start in interface AgentInterface- Overrides:
start in class ServiceAgent
log
public void log(java.lang.String s)
- Writes information given as a String input to log file.
createLogFile
protected void createLogFile()
- Initializes log File / checks to see if matching file already exists.
closeLogFile
protected void closeLogFile()
- Properly closes the currently open log file.