Package com.luciad.util.logging
Class TLcdJULFileHandler
java.lang.Object
java.util.logging.Handler
com.luciad.util.logging.TLcdJULFileHandler
A
Handler that logs all messages to a file. This class is
similar to the standard FileHandler but it can be used by any number
of Loggers.
The TLcdJULFileHandler maintains a list of several log files.
The current (most recent) file has the index 0 while older logs have
corresponding increasing numbers. When the size of the current log file
exceeds a certain limit, the log files are rotated. The total number of log
files is also limited - if the limit is exceeded then the oldest file is
deleted.
The first time a handler of this type is created, it reads the following properties from the logging configuration file:
- com.luciad.util.logging.TLcdJULFileHandler.level specifies the level of
this
Handler. The default isLevel.INFO. - com.luciad.util.logging.TLcdJULFileHandler.filter specifies the name of a
Filterclass. The default is no filter. - com.luciad.util.logging.TLcdJULFileHandler.formatter specifies the name
of a
Formatterclass. The default isTLcdSimpleFomratter. - com.luciad.util.logging.TLcdJULFileHandler.encoding specifies the name of the character set encoding. If not specified, the default platform encoding is used.
- com.luciad.util.logging.TLcdJULFileHandler.limit specifies the approximate maximum size of a log file in bytes. The default is 1 MByte.
- com.luciad.util.logging.TLcdJULFileHandler.count specifies how many log files should be kept. If this number is exceeded, the oldest file is deleted. The default value is 5.
- com.luciad.util.logging.TLcdJULFileHandler.pattern specifies the pattern for generating the output file name (see below). The default is "%h/java%g.log".
- com.luciad.util.logging.TLcdJULFileHandler.append specifies whether the
handler should append to any existing log file or to rotate the logs when the
application starts. The default is
false, meaning that the logs are rotated and a new file is created.
A pattern consists of a string that includes the following special components that will be replaced at runtime:
- "/" the local pathname separator.
- "%t" the system temporary directory.
- "%h" the value of the "user.home" system property.
- "%g" the generation number to distinguish rotated logs. The current (most recent) log has index 0.
- "%%" translates to a single percent sign "%".
- Since:
- 9.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TLcdJULFileHandler with the default settings. -
Method Summary
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
-
Constructor Details
-
TLcdJULFileHandler
public TLcdJULFileHandler()Creates a new TLcdJULFileHandler with the default settings.
-
-
Method Details
-
publish
Writes the givenLogRecordto the log. The file is flushed after each log record. -
flush
public void flush()Flushes any buffered message. -
close
Closes the stream of the current TLcdJULFileHandler..- Specified by:
closein classHandler- Throws:
SecurityException
-