Grace Software
JavaLog
$Revision: 1.3 $
$Date: 2000/02/02 14:34:23 $
|
$ java -Dlog.handler.name.url=file:filename MyClassThis will cause JavaLog to write all events to filename. Here, filename can be either an absolute filename or a relative filename. Absolute files have a path prefix like /tmp/JavaLog/application.log. Relative paths have no path prefix like data/application.log and are relative to the current directory in which the java program is run.
The filename may contain java.text.SimpleDateFormat characters like "%(simple-date-format). For example:
-Dlog.handler.file.url="file:%(hh:mm:ss).log"
For example:
$ java -Dlog.handler.file.url="file:%(hh:mm:ss).log" -Dlog.handler.file.maxsize=1500k -Dlog.handler.file.maxsize.action=new MyClassIn the above example, a FileHandler is established (named "file") that will write to a file using the hour, minute, and second as its name with .log as the extension. It also configures the Handler to limit the file size to 1.5 megabytes and to create a new file each time the size limit is reached.
log.handler.name.maxsize.action=new
,
JavaLog will close the current log file when the maxsize is reached
and open a new one. At this time, the closed file can be compressed
by specifying
log.handler.name.compression=compression-type
property. Here the compression-type can be zip,
gzip, or zlib.
These compression types are assumed if the filename uses the extensions ".gz", ".zip", or ".z" respectively. So, the following example establishes a FileHandler to compress with gzip after the file reaches 1.5 megabytes:
$ java -Dlog.handler.file.url="file:%(hh:mm:ss).gz" -Dlog.handler.file.maxsize=1500k MyClassThere are a few things to notice here:
maxsize.action=new
is is assumed because
compression is used.