org.safs.staf.service.logging
Class STAFTextLogItem

java.lang.Object
  extended by org.safs.logging.LogItem
      extended by org.safs.logging.FileLogItem
          extended by org.safs.staf.service.logging.STAFFileLogItem
              extended by org.safs.staf.service.logging.STAFTextLogItem

public class STAFTextLogItem
extends STAFFileLogItem

This class encapsulates a standard SAFS text file log implemented using STAF. Log messages are written to a temporary STAF log while the log is running. Upon closing, the content of of the STAF log is formatted to the SAFS text log standard and exported to the destination log file.

Note that logging function of this class is for local use only.


Field Summary
 
Fields inherited from class org.safs.staf.service.logging.STAFFileLogItem
handle, LINEFEED, SAFSLOG_MAJOR_VER, SAFSLOG_MINOR_VER
 
Fields inherited from class org.safs.logging.LogItem
closed, enabled, level, mode, name
 
Constructor Summary
STAFTextLogItem(java.lang.String file)
          Creates a disabled STAFTextLogItem with default name (file name) and log level (LOGLEVEL_INFO), and empty parent directory.
STAFTextLogItem(java.lang.String parent, java.lang.String file)
          Creates a disabled STAFTextLogItem with default name (file name) and log level (LOGLEVEL_INFO).
STAFTextLogItem(java.lang.String name, java.lang.String parent, java.lang.String file)
          Creates a disabled STAFTextLogItem with default log level (LOGLEVEL_INFO).
 
Method Summary
 void close()
          Close this log if enabled and open.
 void init()
          Initializes this log and writes the log open message.
 void logMessage(java.lang.String msg)
          Logs a message in standard SAFS text log format if enabled and open.
 void logMessage(java.lang.String msg, int msgType)
          Logs a message in standard SAFS text log format if enabled and open.
 void logMessage(java.lang.String msg, java.lang.String desc, int msgType)
          Logs a message in standard SAFS text log format if enabled and open.
 
Methods inherited from class org.safs.staf.service.logging.STAFFileLogItem
appendFinalLog, exportSTAFLog, finalizeLogFile, prependFinalLog, readStringFromSTAFLog, readUIntFromSTAFLog, setHandle, stafLogLog, stafLogLog, stafLogRequest
 
Methods inherited from class org.safs.logging.FileLogItem
fileExists, getAbsolutePath, getFileSpec, getParentDir, isFileSpecAbsolute, setParentDir
 
Methods inherited from class org.safs.logging.LogItem
dateTime, isClosed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

STAFTextLogItem

public STAFTextLogItem(java.lang.String name,
                       java.lang.String parent,
                       java.lang.String file)
Creates a disabled STAFTextLogItem with default log level (LOGLEVEL_INFO).

The type of this log item is always LOGMODE_SAFS_TEXT.

Parameters:
name - the name of this log.
parent - the parent directory for this log.
file - the file spec of this log.

STAFTextLogItem

public STAFTextLogItem(java.lang.String parent,
                       java.lang.String file)
Creates a disabled STAFTextLogItem with default name (file name) and log level (LOGLEVEL_INFO).

The type of this log item is always LOGMODE_SAFS_TEXT.

Parameters:
parent - the parent directory for this log.
file - the file spec of this log.

STAFTextLogItem

public STAFTextLogItem(java.lang.String file)
Creates a disabled STAFTextLogItem with default name (file name) and log level (LOGLEVEL_INFO), and empty parent directory.

The type of this log item is always LOGMODE_SAFS_TEXT.

Parameters:
file - the file spec of this log.
Method Detail

init

public void init()
Initializes this log and writes the log open message.

Overrides:
init in class STAFFileLogItem

logMessage

public void logMessage(java.lang.String msg,
                       java.lang.String desc,
                       int msgType)
Logs a message in standard SAFS text log format if enabled and open.

Specified by:
logMessage in class LogItem
Parameters:
msg - the message to log.
desc - additional description to log.
msgType - the int identifier of the type of message being logged.

logMessage

public void logMessage(java.lang.String msg,
                       int msgType)
Logs a message in standard SAFS text log format if enabled and open.

Parameters:
msg - the message to log.
msgType - the int identifier of the type of message being logged.

logMessage

public void logMessage(java.lang.String msg)
Logs a message in standard SAFS text log format if enabled and open.

Message type defaults to GENERIC_MESSAGE.

Parameters:
msg - the message to log.

close

public void close()
           throws STAFLogException
Close this log if enabled and open.

Specified by:
close in class STAFFileLogItem
Throws:
STAFLogException - if this method failed for any reason.