ErrorAware
, LogTarget
, Closeable
RotatingFileTarget
, SafeFileTarget
public class FileTarget extends StreamTarget
Modifier and Type | Field | Description |
---|---|---|
private boolean |
m_append |
|
private java.io.File |
m_file |
Constructor | Description |
---|---|
FileTarget(java.io.File file,
boolean append,
Formatter formatter) |
Construct file target to write to a file with a formatter.
|
Modifier and Type | Method | Description |
---|---|---|
protected java.io.File |
getFile() |
Retrieve file associated with target.
|
protected void |
openFile() |
Open underlying file and allocate resources.
|
protected void |
setFile(java.io.File file,
boolean append) |
Set the file for this target.
|
doProcessEvent, getFormatter, open
getErrorHandler, isOpen, processEvent, setErrorHandler
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, setOutputStream, shutdownStream, write
public FileTarget(java.io.File file, boolean append, Formatter formatter) throws java.io.IOException
file
- the file to write toappend
- true if file is to be appended to, false otherwiseformatter
- the Formatterjava.io.IOException
- if an error occursprotected void setFile(java.io.File file, boolean append) throws java.io.IOException
file
- the file to write toappend
- true if file is to be appended to, false otherwisejava.io.IOException
- if directories can not be created or file can not be openedprotected void openFile() throws java.io.IOException
java.io.IOException
- if directories can not be created or file can not be openedprotected java.io.File getFile()
Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.