com.hp.hpl.jena.util
Class LogFileHandler

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

public class LogFileHandler
extends java.lang.Object
implements LogHandler

Basic handler for writing log messages to a log file.

Version:
CVS info: $Id: LogFileHandler.java,v 1.3 2001/08/31 15:04:51 ijd Exp $
Author:
Ian Dickinson, HP Labs (email)

Field Summary
static char FIELD_SEP
          Character used to separate fields in the output.
 
Constructor Summary
LogFileHandler(java.lang.String fileName)
          Construct a log file handler to write to the given log file, overwriting any existing content in the log file.
LogFileHandler(java.lang.String fileName, boolean append)
          Construct a log file handler to write to the given log file.
 
Method Summary
 void close()
          Close the log file handler.
 void publish(int level, java.lang.String msg, java.lang.String cls, java.lang.String method, java.lang.Throwable ex)
          Publish the given information to the log file opened by the constructor.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELD_SEP

public static final char FIELD_SEP
Character used to separate fields in the output. Default: tab
Constructor Detail

LogFileHandler

public LogFileHandler(java.lang.String fileName,
                      boolean append)
               throws java.io.IOException
Construct a log file handler to write to the given log file.
Parameters:
fileName - The name of the log file to write to.
append - If true, append to the end of an existing log file. If false, the existing file will be overwritten.
Throws:
java.io.IOException - if the file cannot be opened for writing.

LogFileHandler

public LogFileHandler(java.lang.String fileName)
               throws java.io.IOException
Construct a log file handler to write to the given log file, overwriting any existing content in the log file.
Parameters:
fileName - The name of the log file to write to.
Throws:
java.io.IOException - if the file cannot be opened for writing.
Method Detail

publish

public void publish(int level,
                    java.lang.String msg,
                    java.lang.String cls,
                    java.lang.String method,
                    java.lang.Throwable ex)
Publish the given information to the log file opened by the constructor.
Specified by:
publish in interface LogHandler
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.

close

public void close()
Close the log file handler.
Specified by:
close in interface LogHandler


Copyright © 2001 Hewlett-Packard. All Rights Reserved.