TwilightMinds.Log
Class FlatFileLog

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--TwilightMinds.Log.Log
              |
              +--TwilightMinds.Log.FlatFileLog
All Implemented Interfaces:
java.lang.Runnable

public class FlatFileLog
extends Log

The FlatFileLog writes to a string-delimited flat file, as might be expected. LogEntry information is recorded:

        timestamp     type     message     exception
 

'null' will be recorded in place of an exception message if there is no such message.

The FlatFileLog also manages file size, shifting oversized files to a backlog list and keeping the current file below a given size limit.

There is currently no way of preventing multiple FlatFileLog objects from attempting to write to the same file; any attempt to prevent this within the Log package could be circumvented in some way, so no attempt is made.

Author: Reason
Last Modified: 12/06/00

------------------------------------------------

Copyright (C) 2000 Twilight Minds. All rights reserved.

This Java package is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this package; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Alternatively, a copy can be obtained from the Twilight Minds web site: http://www.twilightminds.com/GNU-LGPL.html

Twilight Minds Design Group http://www.twilightminds.com/


Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FlatFileLog(java.lang.String inputname, java.lang.String inputlogfilepath, java.lang.String inputdelimiter, long inputmaxfilesizeinkilobytes)
          The standard constructor for a FlatFileLog object.
FlatFileLog(java.lang.String inputname, java.lang.String inputlogfilepath, java.lang.String inputdelimiter, long inputmaxfilesizeinkilobytes, long inputcycledelay)
          Constructor allowing for specification of the cycle delay between periods of recording LogEntry objects.
 
Method Summary
 java.lang.String getDelimiter()
          Return the delimiter string for this log.
 java.lang.String getLogFilePath()
          Return the path for the log file written by this Log.
 long getMaxFileSizeInKiloBytes()
          Return the maximum file size for this log.
protected  void recordLogEntry(LogEntry logentry)
          Output a LogEntry object to the flat file.
 
Methods inherited from class TwilightMinds.Log.Log
addLogEntry, getCycleDelay, getLogName, isLogging, run, setCycleDelay, startLogging, stopLogging
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FlatFileLog

public FlatFileLog(java.lang.String inputname,
                   java.lang.String inputlogfilepath,
                   java.lang.String inputdelimiter,
                   long inputmaxfilesizeinkilobytes)
            throws LogException
The standard constructor for a FlatFileLog object.

FlatFileLog

public FlatFileLog(java.lang.String inputname,
                   java.lang.String inputlogfilepath,
                   java.lang.String inputdelimiter,
                   long inputmaxfilesizeinkilobytes,
                   long inputcycledelay)
            throws LogException
Constructor allowing for specification of the cycle delay between periods of recording LogEntry objects.
Method Detail

getLogFilePath

public java.lang.String getLogFilePath()
Return the path for the log file written by this Log.

getDelimiter

public java.lang.String getDelimiter()
Return the delimiter string for this log.

getMaxFileSizeInKiloBytes

public long getMaxFileSizeInKiloBytes()
Return the maximum file size for this log.

recordLogEntry

protected void recordLogEntry(LogEntry logentry)
                       throws java.lang.Exception
Output a LogEntry object to the flat file.
Overrides:
recordLogEntry in class Log