|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.logging.Handler
java.util.logging.StreamHandler
jpl.mipl.pgs.utils.logging.LogHandler
LoggerFactory instead.
public class LogHandler
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.
| 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 |
|---|
public static final long DEFAULT_MAX_LOG_FILE_SIZE
| Constructor Detail |
|---|
public LogHandler(String upfFileName)
throws IllegalArgumentException,
InvalidPreferencesFormatException
upfFileName - The file to be used to obtain LOG_DIR,
LOG_FILE_NAME_PREFIX and LOG_FILE_MAX_SIZE.
IllegalArgumentException - The upf file does not exists
or @see LogHandler(UPF)
InvalidPreferencesFormatExceptionUPF.UPF(String)
public LogHandler(UPF upf)
throws IllegalArgumentException,
InvalidPreferencesFormatException,
MissingResourceException
upf - The ufp object to be used to obtain LOG_DIR,
LOG_FILE_NAME_PREFIX and LOG_FILE_MAX_SIZE.
IllegalArgumentException - If LOG_DIR or LOG_FILE_NAME_PREFIX are
missing or @see LogHandler(String,String,long) and
InvalidPreferencesFormatException
MissingResourceExceptionUPF.getLastValue(String)
public LogHandler(Map ht)
throws IllegalArgumentException,
InvalidPreferencesFormatException,
MissingResourceException
IllegalArgumentException
InvalidPreferencesFormatException
MissingResourceException
public LogHandler(String dirPath,
String fileNamePrefix)
throws IllegalArgumentException
dirPath - The directory where the log file is to be created.fileNamePrefix - The prefix of the log file name. Time is attached to this.
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.DEFAULT_MAX_LOG_FILE_SIZE
public LogHandler(String dirPath,
String fileNamePrefix,
long maxLogFileSize)
throws IllegalArgumentException
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.
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 |
|---|
public void publish(LogRecord inLr)
publish in class StreamHandler
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||