public class FileAppender<E> extends OutputStreamAppender<E>
| Type | Property and Description |
|---|---|
String |
rawFile
This method is used by derived classes to obtain the raw file property.
|
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
append
Append to or truncate the file? The default value for this variable is
true, meaning that by default a
FileAppender will append to an existing file and not truncate it.
|
protected String |
fileName
The name of the active log file.
|
encoder, lockname, startedcontext| Constructor and Description |
|---|
FileAppender()
|
| Modifier and Type | Method and Description |
|---|---|
String |
getFile()
Returns the value of the
File property.
|
boolean |
isAppend()
Returns the value of the
Append property.
|
boolean |
isPrudent()
|
void |
openFile(String
Sets and
opens the file where the log output will go.
|
String |
rawFileProperty()
This method is used by derived classes to obtain the raw file property.
|
void |
setAppend(boolean append)
|
void |
setFile(String
The
File property takes a string value which should be the name of the file to append to.
|
void |
setPrudent(boolean prudent)
When prudent is set to true, file appenders from multiple JVMs can safely write to the same file.
|
void |
start()
If the value of
File is not
null, then
openFile(java.lang.String) is called with the values of
File and
Append properties.
|
protected void |
writeOut(E event)
|
append, closeOutputStream, getEncoder, getOutputStream, setEncoder, setLayout, setOutputStream, stop, subAppendaddFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getName, isStarted, setName, toStringaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContextpublic final StringrawFileProperty
protected boolean append
true, meaning that by default a
FileAppender will append to an existing file and not truncate it.
protected StringfileName
public void setFile(Stringfile)
public boolean isAppend()
public final StringrawFileProperty()
public StringgetFile()
This method may be overridden by derived classes.
public void start()
null, then
openFile(java.lang.String) is called with the values of
File and
Append properties.
public void openFile(Stringfile_name) throws IOException
Sets and opens the file where the log output will go. The specified file must be writable.
If there was already an opened file, then the previous file is closed first.
Do not use this method directly. To configure a FileAppender or one of its subclasses, set its properties one by one and then call start().
file_name - The path to the log file.
IOException
public boolean isPrudent()
setPrudent(boolean)
public void setPrudent(boolean prudent)
prudent -
public void setAppend(boolean append)
protected void writeOut(E event) throws IOException
writeOut in class
OutputStreamAppender<E>
IOException