org.apache.log.output.io.rotate

Class RotatingFileTarget

public class RotatingFileTarget extends FileTarget

This is a basic Output log target that writes to rotating files.

Author: Peter Donald Stephen McConnell Bernhard Huber

Field Summary
booleanm_append
FileStrategym_fileStrategy
RotateStrategym_rotateStrategy
Constructor Summary
RotatingFileTarget(Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
Construct RotatingFileTarget object.
RotatingFileTarget(boolean append, Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
Construct RotatingFileTarget object.
Method Summary
protected voidrotate()
Rotates the file.
protected voidwrite(String data)
Output the log message, and check if rotation is needed.

Field Detail

m_append

private boolean m_append

m_fileStrategy

private FileStrategy m_fileStrategy

m_rotateStrategy

private RotateStrategy m_rotateStrategy

Constructor Detail

RotatingFileTarget

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

Parameters: formatter Formatter to be used rotateStrategy RotateStrategy to be used fileStrategy FileStrategy to be used

Throws: IOException if a file access or write related error occurs

RotatingFileTarget

public RotatingFileTarget(boolean append, Formatter formatter, RotateStrategy rotateStrategy, FileStrategy fileStrategy)
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

Throws: IOException if a file access or write related error occurs

Method Detail

rotate

protected void rotate()
Rotates the file.

Throws: IOException if a file access or write related error occurs

write

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

Parameters: data the date to write to the target