jpl.mipl.pgs.utils.logging
Class LogHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by jpl.mipl.pgs.utils.logging.LogHandler

Deprecated. Use LoggerFactory instead.

public class LogHandler
extends StreamHandler

The logger allows loging to a specified file, while allowing archiving of log files as they reach the specified size.


     Copyright 2002, California Institute of Technology.
     ALL RIGHTS RESERVED.
     U.S. Government Sponsorship acknowledge.2002.

     MIPL Telemetry Processing Subsystem
 
The log handler is used in the java.util.logging framework. This handler creates a log file specified in LOG_DIR with prefix LOG_FILE_NAME_PREFIX suffixed with ".log". If the log file exists, logging resumes to that file. If the MAX_LOG_FILE_SIZE is specified (in kilo bytes), it is utilized otherwise the default as specified by LogHandler::DEFAULT_MAX_LOG_FILE_SIZE is utilized. Once a log file size passes the specified max, the current log file is archived as dirPath/logFilePrefix_{timestamp}.log where timestamp is of the format yyyy_mm_dd-hh:mm:ss:SSS, logging is resumed in newly created log file named dirPath/logFilePrefix.log (this is the name used when log file is created for the first time. Also, dirPath and logFilePrefix are supplied UPF). NOTE:The logger does not break a message and log it to two different log files. Thus, for safety reason, if the current log size plus the message size exceeds the max log file size, the current log file is archived and the message is logged to newly created log file. As a result, most of the archived log files will have sizes less than the specified maximum. Also, for a newly created file, the first message is always logged regard less of its size.

Version:
1.0
Author:
Raj Patel (rrp@mipl.jpl.nasa.gov)

Field Summary
static long DEFAULT_MAX_LOG_FILE_SIZE
          Deprecated. The default log file size is 100KB.
 
Constructor Summary
LogHandler(Map ht)
          Deprecated.  
LogHandler(String upfFileName)
          Deprecated.  
LogHandler(String dirPath, String fileNamePrefix)
          Deprecated. Creates a logger that used default log file size as specified by
LogHandler(String dirPath, String fileNamePrefix, long maxLogFileSize)
          Deprecated.  
LogHandler(UPF upf)
          Deprecated. Constructor.
 
Method Summary
 void publish(LogRecord inLr)
          Deprecated.  
 
Methods inherited from class java.util.logging.StreamHandler
close, flush, isLoggable, setEncoding, setOutputStream
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_LOG_FILE_SIZE

public static final long DEFAULT_MAX_LOG_FILE_SIZE
Deprecated. 
The default log file size is 100KB.

See Also:
Constant Field Values
Constructor Detail

LogHandler

public LogHandler(String upfFileName)
           throws IllegalArgumentException,
                  InvalidPreferencesFormatException
Deprecated. 
Parameters:
upfFileName - The file to be used to obtain LOG_DIR, LOG_FILE_NAME_PREFIX and LOG_FILE_MAX_SIZE.
Throws:
IllegalArgumentException - The upf file does not exists or @see LogHandler(UPF)
InvalidPreferencesFormatException
See Also:
UPF.UPF(String)

LogHandler

public LogHandler(UPF upf)
           throws IllegalArgumentException,
                  InvalidPreferencesFormatException,
                  MissingResourceException
Deprecated. 
Constructor.

Parameters:
upf - The ufp object to be used to obtain LOG_DIR, LOG_FILE_NAME_PREFIX and LOG_FILE_MAX_SIZE.
Throws:
IllegalArgumentException - If LOG_DIR or LOG_FILE_NAME_PREFIX are missing or @see LogHandler(String,String,long) and
InvalidPreferencesFormatException
MissingResourceException
See Also:
UPF.getLastValue(String)

LogHandler

public LogHandler(Map ht)
           throws IllegalArgumentException,
                  InvalidPreferencesFormatException,
                  MissingResourceException
Deprecated. 
Throws:
IllegalArgumentException
InvalidPreferencesFormatException
MissingResourceException

LogHandler

public LogHandler(String dirPath,
                  String fileNamePrefix)
           throws IllegalArgumentException
Deprecated. 
Creates a logger that used default log file size as specified by

Parameters:
dirPath - The directory where the log file is to be created.
fileNamePrefix - The prefix of the log file name. Time is attached to this.
Throws:
IllegalArgumentException - If the directory does not exists or it is not a directory it is unreadable or the maxLogFileSize is less than or equal to zero.
See Also:
DEFAULT_MAX_LOG_FILE_SIZE

LogHandler

public LogHandler(String dirPath,
                  String fileNamePrefix,
                  long maxLogFileSize)
           throws IllegalArgumentException
Deprecated. 
Parameters:
dirPath - The directory where the log file is to be created.
fileNamePrefix - The prefix of the log file name.
maxLogFileSize - The cutoff log file size.
Throws:
IllegalArgumentException - If the directory does not exists or it is not a directory it is unreadable or the maxLogFileSize is less than or equal to zero. Warning:The performance and behavior of this class are unpredictable with smaller maxLogFileSize values.
Method Detail

publish

public void publish(LogRecord inLr)
Deprecated. 
Overrides:
publish in class StreamHandler