com.hp.hpl.jena.util
Class AlternatingLogFileHandler

java.lang.Object
  |
  +--com.hp.hpl.jena.util.LogFileHandler
        |
        +--com.hp.hpl.jena.util.AlternatingLogFileHandler
All Implemented Interfaces:
LogHandler

public class AlternatingLogFileHandler
extends LogFileHandler

A log file handler which write the log to a number of files in a round robbin fashion.

This is a subclass of LogFileHandler, which instead of writing all the log data to one file, will write numEntries entries to one file, then the next numEntries to another, continuing until numFiles files have been written when it will start again with the first file.

The files are written according to a pattern:

         fileNameRoot[N].fileNameExt
 

This log file handler is useful for long term logging when the amount of log data generated is large, but only the latest entries are of interest.

Version:
$Revision: 1.2 $
Author:
bwm

Field Summary
static int DEFAULT_ENTRIES_PER_FILE
          The default number of entries per file.
static java.lang.String DEFAULT_FILE_NAME_EXT
          The default extension part of the log file name.
static java.lang.String DEFAULT_FILE_NAME_ROOT
          The default root part of the log file name.
static int DEFAULT_NUM_FILES
          The default number of files.
 
Fields inherited from class com.hp.hpl.jena.util.LogFileHandler
FIELD_SEP
 
Constructor Summary
AlternatingLogFileHandler()
          Create an AlternatingLogFileHandler with a default configuration.
AlternatingLogFileHandler(java.lang.String fileNameRoot, java.lang.String fileNameExt)
          Create an AlternatingLogFileHandler with a given root file name and extension.
AlternatingLogFileHandler(java.lang.String fileNameRoot, java.lang.String fileNameExt, int numFiles, int entriesPerFile)
          Creates new AlternatingLogFileHandler with the specifed configuration.
 
Method Summary
 void publish(int level, java.lang.String msg, java.lang.String cls, java.lang.String method, java.lang.Throwable ex)
          The same as LogFileHandler.publish(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Throwable)
 
Methods inherited from class com.hp.hpl.jena.util.LogFileHandler
close
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FILE_NAME_ROOT

public static java.lang.String DEFAULT_FILE_NAME_ROOT
The default root part of the log file name.

DEFAULT_FILE_NAME_EXT

public static java.lang.String DEFAULT_FILE_NAME_EXT
The default extension part of the log file name.

DEFAULT_NUM_FILES

public static int DEFAULT_NUM_FILES
The default number of files. The value is 3.

DEFAULT_ENTRIES_PER_FILE

public static int DEFAULT_ENTRIES_PER_FILE
The default number of entries per file. The value is 5000.
Constructor Detail

AlternatingLogFileHandler

public AlternatingLogFileHandler()
                          throws java.io.IOException
Create an AlternatingLogFileHandler with a default configuration.
Throws:
java.io.IOException - can occur creating the log files

AlternatingLogFileHandler

public AlternatingLogFileHandler(java.lang.String fileNameRoot,
                                 java.lang.String fileNameExt)
                          throws java.io.IOException
Create an AlternatingLogFileHandler with a given root file name and extension.
Parameters:
fileNameRoot - the root part of the log file names
fileNameExt - the extension part of the filenames
Throws:
java.io.IOException - can occur creating the files

AlternatingLogFileHandler

public AlternatingLogFileHandler(java.lang.String fileNameRoot,
                                 java.lang.String fileNameExt,
                                 int numFiles,
                                 int entriesPerFile)
                          throws java.io.IOException
Creates new AlternatingLogFileHandler with the specifed configuration.
Parameters:
fileNameRoot - the root part of the log file names
fileNameExt - the extension part of the log file names
numFiles - the number of log files to use
entriesPerFile - the number of log entries in each file
Throws:
java.io.IOException - can occur creating the log file
Method Detail

publish

public void publish(int level,
                    java.lang.String msg,
                    java.lang.String cls,
                    java.lang.String method,
                    java.lang.Throwable ex)
The same as LogFileHandler.publish(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Throwable)
Overrides:
publish in class LogFileHandler
Following copied from class: com.hp.hpl.jena.util.LogFileHandler
Parameters:
level - The log level that this message is published at
msg - The log message to be published.
cls - Optional name of the class that originated the log request.
method - Optional name of the method that originated the log request.
ex - Optional throwable that triggered the log request.


Copyright 2001 Hewlett-Packard. All Rights Reserved.