Top Description Fields Constructors Methods
org.apache.log.output.io.rotate

public Class RotatingFileTarget

extends FileTarget
Class Inheritance
Imports
java.io.File, .IOException, org.apache.log.format.Formatter, org.apache.log.output.io.FileTarget

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

Field Summary

Modifier and TypeField and Description
private boolean
private FileStrategy
private RotateStrategy

Constructor Summary

AccessConstructor and Description
public
RotatingFileTarget(final Formatter
Formatter to be used
formatter
,
final RotateStrategy
RotateStrategy to be used
rotateStrategy
,
final FileStrategy
FileStrategy to be used
fileStrategy
)

Construct RotatingFileTarget object.

public
RotatingFileTarget(final boolean
true if file is to be appended to, false otherwise
append
,
final Formatter
Formatter to be used
formatter
,
final RotateStrategy
RotateStrategy to be used
rotateStrategy
,
final FileStrategy
FileStrategy to be used
fileStrategy
)

Construct RotatingFileTarget object.

Method Summary

Modifier and TypeMethod and Description
protected synchronized void
rotate()

Rotates the file.

protected synchronized void
write(final String
the date to write to the target
data
)

Overrides org.apache.log.output.io.StreamTarget.write.

Output the log message, and check if rotation is needed.
Inherited from org.apache.log.output.io.FileTarget:
getFileopenFilesetFile

Field Detail

m_appendback to summary
private boolean m_append

Hides org.apache.log.output.io.FileTarget.m_append.

m_fileStrategyback to summary
private FileStrategy m_fileStrategy
m_rotateStrategyback to summary
private RotateStrategy m_rotateStrategy

Constructor Detail

RotatingFileTargetback to summary
public RotatingFileTarget(final Formatter formatter, final RotateStrategy rotateStrategy, final FileStrategy fileStrategy) throws IOException

Construct RotatingFileTarget object.

Parameters
formatter:Formatter

Formatter to be used

rotateStrategy:RotateStrategy

RotateStrategy to be used

fileStrategy:FileStrategy

FileStrategy to be used

Exceptions
IOException:
if a file access or write related error occurs
RotatingFileTargetback to summary
public RotatingFileTarget(final boolean append, final Formatter formatter, final RotateStrategy rotateStrategy, final FileStrategy fileStrategy) throws IOException

Construct RotatingFileTarget object.

Parameters
append:boolean

true if file is to be appended to, false otherwise

formatter:Formatter

Formatter to be used

rotateStrategy:RotateStrategy

RotateStrategy to be used

fileStrategy:FileStrategy

FileStrategy to be used

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

Method Detail

rotateback to summary
protected synchronized void rotate() throws IOException

Rotates the file.

Exceptions
IOException:
if a file access or write related error occurs
writeback to summary
protected synchronized void write(final String data)

Overrides org.apache.log.output.io.StreamTarget.write.

Output the log message, and check if rotation is needed.

Parameters
data:String

the date to write to the target