Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.log
Class RotatingFileHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by com.jivesoftware.base.log.RotatingFileHandler

public class RotatingFileHandler
extends java.util.logging.Handler

This is a basic Output log target that writes to rotating files. Based off the apache logkit RotatingFileHandler written by Peter Donald, Stephen McConnell, and Bernard Huber


Constructor Summary
RotatingFileHandler(java.util.logging.Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
          Construct RotatingFileHandler object.
 
Method Summary
 void close()
          Shutdown target.
 void flush()
           
protected  java.io.File getFile()
          Retrieve file associated with target.
protected  void openFile()
          Open underlying file and allocate resources.
 void publish(java.util.logging.LogRecord logRecord)
          Output the log message, and check if rotation is needed.
 void rotate()
           
protected  void setFile(java.io.File file, boolean append)
          Set the file for this target.
protected  void shutdownWriter()
          Shutdown output stream.
 void write(java.lang.String s)
           
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RotatingFileHandler

public RotatingFileHandler(java.util.logging.Formatter formatter,
                           RotateStrategy rotateStrategy,
                           FileStrategy fileStrategy)
                    throws java.io.IOException
Construct RotatingFileHandler object.

Parameters:
formatter - Formatter to be used
Throws:
java.io.IOException
Method Detail

rotate

public void rotate()
            throws java.io.IOException
Throws:
java.io.IOException

publish

public void publish(java.util.logging.LogRecord logRecord)
Output the log message, and check if rotation is needed.

Specified by:
publish in class java.util.logging.Handler

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

setFile

protected void setFile(java.io.File file,
                       boolean append)
                throws java.io.IOException
Set the file for this target.

Parameters:
file - the file to write to
append - true if file is to be appended to, false otherwise
Throws:
java.io.IOException - if directories can not be created or file can not be opened

getFile

protected java.io.File getFile()
Retrieve file associated with target. This allows subclasses to access file object.

Returns:
the output File

openFile

protected void openFile()
                 throws java.io.IOException
Open underlying file and allocate resources. This method will attempt to create directories below file and append to it if specified.

Throws:
java.io.IOException

close

public void close()
Shutdown target. Attempting to write to target after close() will cause errors to be logged.

Specified by:
close in class java.util.logging.Handler

shutdownWriter

protected void shutdownWriter()
Shutdown output stream.


write

public void write(java.lang.String s)

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.