org.apache.log.output.io.rotate

Class RotatingFileTarget

Implemented Interfaces:
ErrorAware, LogTarget

public class RotatingFileTarget
extends FileTarget

This is a basic Output log target that writes to rotating files.
Authors:
Peter Donald
Stephen McConnell
Bernhard Huber

Field Summary

Fields inherited from class org.apache.log.output.AbstractOutputTarget

m_formatter

Constructor Summary

RotatingFileTarget(boolean append, Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
Construct RotatingFileTarget object.
RotatingFileTarget(Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
Construct RotatingFileTarget object.

Method Summary

protected void
rotate()
Rotates the file.
protected void
write(String data)
Output the log message, and check if rotation is needed.

Methods inherited from class org.apache.log.output.io.FileTarget

getFile, openFile, setFile

Methods inherited from class org.apache.log.output.io.StreamTarget

close, setOutputStream, shutdownStream, write

Methods inherited from class org.apache.log.output.AbstractOutputTarget

close, doProcessEvent, getFormatter, open, output, setFormatter, write

Methods inherited from class org.apache.log.output.AbstractTarget

close, doProcessEvent, error, getErrorHandler, isOpen, open, processEvent, setErrorHandler

Constructor Details

RotatingFileTarget

public RotatingFileTarget(boolean append,
                          Formatter formatter,
                          RotateStrategy rotateStrategy,
                          FileStrategy fileStrategy)
            throws IOException
Construct RotatingFileTarget object.
Parameters:
append - true if file is to be appended to, false otherwise
formatter - Formatter to be used
rotateStrategy - RotateStrategy to be used
fileStrategy - FileStrategy to be used

RotatingFileTarget

public RotatingFileTarget(Formatter formatter,
                          RotateStrategy rotateStrategy,
                          FileStrategy fileStrategy)
            throws IOException
Construct RotatingFileTarget object.
Parameters:
formatter - Formatter to be used
rotateStrategy - RotateStrategy to be used
fileStrategy - FileStrategy to be used

Method Details

rotate

protected void rotate()
            throws IOException
Rotates the file.

write

protected void write(String data)
Output the log message, and check if rotation is needed.
Overrides:
write in interface StreamTarget
Parameters:
data - the date to write to the target