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

public Class SafeFileTarget

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

A target that will open and close a file for each logevent. This is slow but a more reliable form of logging on some filesystems/OSes. It should only be used when there is a small number of log events.
Author
Peter Donald

Constructor Summary

AccessConstructor and Description
public
SafeFileTarget(final File
the file to write to
file
,
final boolean
true if file is to be appended to, false otherwise
append
,
final Formatter
the Formatter
formatter
)

Construct file target to write to a file with a formatter.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
processEvent(final LogEvent
the log event
event
)

Overrides org.apache.log.output.AbstractTarget.processEvent.

Implements org.apache.log.LogTarget.processEvent.

Process a log event, via formatting and outputting it.
Inherited from org.apache.log.output.io.FileTarget:
getFileopenFilesetFile

Constructor Detail

SafeFileTargetback to summary
public SafeFileTarget(final File file, final boolean append, final Formatter formatter) throws IOException

Construct file target to write to a file with a formatter.

Parameters
file:File

the file to write to

append:boolean

true if file is to be appended to, false otherwise

formatter:Formatter

the Formatter

Exceptions
IOException:
if an error occurs

Method Detail

processEventback to summary
public synchronized void processEvent(final LogEvent event)

Overrides org.apache.log.output.AbstractTarget.processEvent.

Implements org.apache.log.LogTarget.processEvent.

Process a log event, via formatting and outputting it.

Parameters
event:LogEvent

the log event