Package org.apache.log.output.io
Class FileTarget
java.lang.Object
org.apache.log.output.AbstractTarget
org.apache.log.output.AbstractOutputTarget
org.apache.log.output.io.StreamTarget
org.apache.log.output.io.FileTarget
- All Implemented Interfaces:
ErrorAware
,LogTarget
,Closeable
- Direct Known Subclasses:
RotatingFileTarget
,SafeFileTarget
A basic target that writes to a File.
- Author:
- Avalon Development Team, Peter Donald
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFileTarget
(File file, boolean append, Formatter formatter) Construct file target to write to a file with a formatter. -
Method Summary
Methods inherited from class org.apache.log.output.io.StreamTarget
close, setOutputStream, shutdownStream, write
Methods inherited from class org.apache.log.output.AbstractOutputTarget
doProcessEvent, getFormatter, open
Methods inherited from class org.apache.log.output.AbstractTarget
getErrorHandler, isOpen, processEvent, setErrorHandler
-
Field Details
-
m_file
-
m_append
private boolean m_append
-
-
Constructor Details
-
FileTarget
Construct file target to write to a file with a formatter.- Parameters:
file
- the file to write toappend
- true if file is to be appended to, false otherwiseformatter
- the Formatter- Throws:
IOException
- if an error occurs
-
-
Method Details
-
setFile
Set the file for this target.- Parameters:
file
- the file to write toappend
- true if file is to be appended to, false otherwise- Throws:
IOException
- if directories can not be created or file can not be opened
-
openFile
Open underlying file and allocate resources. This method will attempt to create directories below file and append to it if specified.- Throws:
IOException
- if directories can not be created or file can not be opened
-
getFile
Retrieve file associated with target. This allows subclasses to access file object.- Returns:
- the output File
-