SmartFrog 3.10.000

org.smartfrog.sfcore.logging
Class LogToFileImpl

java.lang.Object
  extended by org.smartfrog.sfcore.logging.LogToNothingImpl
      extended by org.smartfrog.sfcore.logging.LogToStreamsImpl
          extended by org.smartfrog.sfcore.logging.LogToFileImpl
All Implemented Interfaces:
Log, LogLevel, LogMessage, LogToFile, LogToNothing, LogToStreams

public class LogToFileImpl
extends LogToStreamsImpl
implements LogToFile

Logs log info into a file.


Field Summary
protected  java.text.DateFormat fileNameDateFormatter
          Used to format date used in filename
 
Fields inherited from class org.smartfrog.sfcore.logging.LogToStreamsImpl
callDepth, currentLogLevel, dateFormatter, ERROR_NAMES, logName, showDateTime, showLogName, showMethodCall, showShortName, showStackTrace, showThreadName
 
Fields inherited from class org.smartfrog.sfcore.logging.LogToNothingImpl
classComponentDescription, componentComponentDescription, errstream, errToOut, outstream
 
Fields inherited from interface org.smartfrog.sfcore.logging.LogToFile
ATR_APPEND, ATR_FILE_NAME_DATE_FORMAT, ATR_FILE_NAME_PREFIX, ATR_LOG_FILE_EXTENSION, ATR_PATH, ATR_REDIRECT_SYSTEM_OUTPUTS, ATR_USE_DATED_FILE_NAME, ATR_USE_HOST_NAME_IN_FILE_NAME, ATR_USE_LOG_NAME_IN_FILE_NAME, ATR_USE_PROCESS_NAME_IN_FILE_NAME
 
Fields inherited from interface org.smartfrog.sfcore.logging.LogToStreams
ATR_DATE_FORMAT, ATR_SHOW_DATE_TIME, ATR_SHOW_LOG_NAME, ATR_SHOW_METHOD_CALL, ATR_SHOW_SHORT_NAME, ATR_SHOW_STACK_TRACE, ATR_SHOW_THREAD_NAME
 
Fields inherited from interface org.smartfrog.sfcore.logging.LogToNothing
ATR_ERR_TO_OUT
 
Fields inherited from interface org.smartfrog.sfcore.logging.LogLevel
LOG_LEVEL_ALL, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_IGNORE, LOG_LEVEL_INFO, LOG_LEVEL_OFF, LOG_LEVEL_TRACE, LOG_LEVEL_WARN
 
Constructor Summary
LogToFileImpl(java.lang.String name, ComponentDescription componentComponentDescription, java.lang.Integer initialLogLevel)
          Construct a simple log with given name and log level and log to output level
LogToFileImpl(java.lang.String name, java.lang.Integer initialLogLevel)
          Construct a simple log with given name and log level and log to output level
 
Method Summary
 java.io.File createFile(java.lang.String fileExtension)
          Creates the file using attributes.
protected  void readSFFileAttributes(ComponentDescription cd)
          Reads optional and mandatory attributes.
 void redirectOutputs()
          Redirects system outputs to a file.
 
Methods inherited from class org.smartfrog.sfcore.logging.LogToStreamsImpl
debug, debug, error, error, fatal, fatal, getLevel, info, info, isDebugEnabled, isErrorEnabled, isFatalEnabled, isInfoEnabled, isLevelEnabled, isTraceEnabled, isWarnEnabled, log, logToText, readSFStreamsAttributes, setErrstream, setLevel, setOutstream, trace, trace, warn, warn, write
 
Methods inherited from class org.smartfrog.sfcore.logging.LogToNothingImpl
err, err, err, err, out, readSFNothingAttributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.smartfrog.sfcore.logging.LogMessage
err, err, err, err, out
 

Field Detail

fileNameDateFormatter

protected java.text.DateFormat fileNameDateFormatter
Used to format date used in filename

Constructor Detail

LogToFileImpl

public LogToFileImpl(java.lang.String name,
                     java.lang.Integer initialLogLevel)
Construct a simple log with given name and log level and log to output level

Parameters:
name - log name
initialLogLevel - level to log at

LogToFileImpl

public LogToFileImpl(java.lang.String name,
                     ComponentDescription componentComponentDescription,
                     java.lang.Integer initialLogLevel)
Construct a simple log with given name and log level and log to output level

Parameters:
name - log name
componentComponentDescription - A component description to overwrite class configuration
initialLogLevel - level to log at
Method Detail

readSFFileAttributes

protected void readSFFileAttributes(ComponentDescription cd)
                             throws SmartFrogException
Reads optional and mandatory attributes.

Parameters:
cd - ComponentDescription A component description to read attributes from
Throws:
SmartFrogException - error while reading attributes

createFile

public java.io.File createFile(java.lang.String fileExtension)
                        throws java.lang.Exception
Creates the file using attributes.

Parameters:
fileExtension - file extension
Returns:
filename
Throws:
java.lang.Exception - error while creating file

redirectOutputs

public void redirectOutputs()
                     throws java.lang.Exception
Redirects system outputs to a file.

Throws:
java.lang.Exception - if any io error

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP