JBoss Log Manager 1.2.0.GA

org.jboss.logmanager.handlers
Class SizeRotatingFileHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.jboss.logmanager.ExtHandler
          extended by org.jboss.logmanager.handlers.WriterHandler
              extended by org.jboss.logmanager.handlers.OutputStreamHandler
                  extended by org.jboss.logmanager.handlers.FileHandler
                      extended by org.jboss.logmanager.handlers.SizeRotatingFileHandler
All Implemented Interfaces:
Closeable, Flushable, FlushableCloseable

public class SizeRotatingFileHandler
extends FileHandler


Field Summary
 
Fields inherited from class org.jboss.logmanager.handlers.WriterHandler
outputLock
 
Fields inherited from class org.jboss.logmanager.ExtHandler
handlers, handlersUpdater
 
Constructor Summary
SizeRotatingFileHandler()
          Construct a new instance with no formatter and no output file.
SizeRotatingFileHandler(File file)
          Construct a new instance with the given output file.
SizeRotatingFileHandler(File file, boolean append)
          Construct a new instance with the given output file and append setting.
SizeRotatingFileHandler(File file, boolean append, long rotateSize, int maxBackupIndex)
          Construct a new instance with the given output file and append setting.
SizeRotatingFileHandler(File file, long rotateSize, int maxBackupIndex)
          Construct a new instance with the given output file.
SizeRotatingFileHandler(long rotateSize, int maxBackupIndex)
          Construct a new instance with no formatter and no output file.
SizeRotatingFileHandler(String fileName)
          Construct a new instance with the given output file.
SizeRotatingFileHandler(String fileName, boolean append)
          Construct a new instance with the given output file and append setting.
 
Method Summary
protected  void preWrite(ExtLogRecord record)
          Execute any pre-write policy, such as file rotation.
 void setFile(File file)
          Set the output file.
 void setMaxBackupIndex(int maxBackupIndex)
          Set the maximum backup index (the number of log files to keep around).
 void setOutputStream(OutputStream outputStream)
          Set the output stream to write to.
 void setRotateSize(long rotateSize)
          Set the rotation size, in bytes.
 
Methods inherited from class org.jboss.logmanager.handlers.FileHandler
getFile, setAppend, setFileName
 
Methods inherited from class org.jboss.logmanager.handlers.OutputStreamHandler
getEncoding, setEncoding, setWriter
 
Methods inherited from class org.jboss.logmanager.handlers.WriterHandler
close, doPublish, flush, safeClose
 
Methods inherited from class org.jboss.logmanager.ExtHandler
addHandler, checkAccess, clearHandlers, getHandlers, isAutoFlush, publish, publish, removeHandler, setAutoFlush, setHandlers
 
Methods inherited from class java.util.logging.Handler
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeRotatingFileHandler

public SizeRotatingFileHandler()
Construct a new instance with no formatter and no output file.


SizeRotatingFileHandler

public SizeRotatingFileHandler(File file)
                        throws FileNotFoundException
Construct a new instance with the given output file.

Parameters:
file - the file
Throws:
FileNotFoundException - if the file could not be found on open

SizeRotatingFileHandler

public SizeRotatingFileHandler(File file,
                               boolean append)
                        throws FileNotFoundException
Construct a new instance with the given output file and append setting.

Parameters:
file - the file
append - true to append, false to overwrite
Throws:
FileNotFoundException - if the file could not be found on open

SizeRotatingFileHandler

public SizeRotatingFileHandler(String fileName)
                        throws FileNotFoundException
Construct a new instance with the given output file.

Parameters:
fileName - the file name
Throws:
FileNotFoundException - if the file could not be found on open

SizeRotatingFileHandler

public SizeRotatingFileHandler(String fileName,
                               boolean append)
                        throws FileNotFoundException
Construct a new instance with the given output file and append setting.

Parameters:
fileName - the file name
append - true to append, false to overwrite
Throws:
FileNotFoundException - if the file could not be found on open

SizeRotatingFileHandler

public SizeRotatingFileHandler(long rotateSize,
                               int maxBackupIndex)
Construct a new instance with no formatter and no output file.


SizeRotatingFileHandler

public SizeRotatingFileHandler(File file,
                               long rotateSize,
                               int maxBackupIndex)
                        throws FileNotFoundException
Construct a new instance with the given output file.

Parameters:
file - the file
Throws:
FileNotFoundException - if the file could not be found on open

SizeRotatingFileHandler

public SizeRotatingFileHandler(File file,
                               boolean append,
                               long rotateSize,
                               int maxBackupIndex)
                        throws FileNotFoundException
Construct a new instance with the given output file and append setting.

Parameters:
file - the file
append - true to append, false to overwrite
Throws:
FileNotFoundException - if the file could not be found on open
Method Detail

setOutputStream

public void setOutputStream(OutputStream outputStream)
Set the output stream to write to.

Overrides:
setOutputStream in class OutputStreamHandler
Parameters:
outputStream - the new output stream or null for none

setFile

public void setFile(File file)
             throws FileNotFoundException
Set the output file.

Overrides:
setFile in class FileHandler
Parameters:
file - the file
Throws:
FileNotFoundException - if an error occurs opening the file

setRotateSize

public void setRotateSize(long rotateSize)
Set the rotation size, in bytes.

Parameters:
rotateSize - the number of bytes before the log is rotated

setMaxBackupIndex

public void setMaxBackupIndex(int maxBackupIndex)
Set the maximum backup index (the number of log files to keep around).

Parameters:
maxBackupIndex - the maximum backup index

preWrite

protected void preWrite(ExtLogRecord record)
Execute any pre-write policy, such as file rotation. The write lock is held during this method, so make it quick. The default implementation does nothing.

Overrides:
preWrite in class WriterHandler
Parameters:
record - the record about to be logged

JBoss Log Manager 1.2.0.GA

Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.