Subsections
DCone's logging facility is built on top of
JDK1.4 style logging.
The usual JDK
log.properties can be used to control the logging
parameters. The system properties that govern how the
log.properties
file is located are:
- Java property -
- -Djava.util.logging.config.file=file-name
If this is specified, it over-rides all other properties.
- Preferences Root -
- -Dprefs.root=prefs-dir-name
If Java property is not specified, DCone will try to locate it in
the prefs directory.
DCone enhances the default JDK logging facility to dump thread-ids,
microsecond timestamps, and automatically attach a default file handler.
The default file handler dumps the log records to files prefixed
by
Main_Class_Name-{prefs_file_prefix}.log.
Log rotation can be setup by specifying the standard Java properties in the
log.properties file. These properties are:
- Maximum log file size -
- java.util.logging.FileHandler.limit = {number of bytes}
If this is specified, it over-rides the default which is unlimited log file size.
- Number of log files -
- java.util.logging.FileHandler.count = {count of files}
It specifies how many log files to cycle through, defaults to 1. Each log file
will have a count appended to it.
Our products, such as CVS Replicator, dump their log records to
installDir/logs.
For the users of our SDK, we provide a programmatic API to control
the log file name and the log directory:
org.nirala.trace.Logger.initDefaultFileHandler(className, logDir);