|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.UnsynchronizedAppenderBase<E>
ch.qos.logback.core.WriterAppender<E>
ch.qos.logback.core.FileAppender<E>
public class FileAppender<E>
FileAppender appends log events to a file. For more information about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#FileAppender
Field Summary | |
---|---|
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 boolean |
bufferedIO
Do we do bufferedIO? |
protected int |
bufferSize
The size of the IO buffer. |
protected java.lang.String |
fileName
The name of the active log file. |
Fields inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase |
---|
layout, name, started |
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
context |
Constructor Summary | |
---|---|
FileAppender()
As in most cases, the default constructor does nothing. |
Method Summary | |
---|---|
boolean |
getAppend()
Deprecated. Use isAppend instead |
int |
getBufferSize()
|
java.lang.String |
getFile()
Returns the value of the File property. |
boolean |
isAppend()
Returns the value of the Append property. |
boolean |
isBufferedIO()
|
boolean |
isPrudent()
|
void |
openFile(java.lang.String file_name)
Sets and opens the file where the log output will go. |
java.lang.String |
rawFileProperty()
This method is used by derived classes to obtain the raw file property. |
void |
setAppend(boolean append)
|
void |
setBufferedIO(boolean bufferedIO)
|
void |
setBufferSize(int bufferSize)
|
void |
setFile(java.lang.String file)
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 |
writerWrite(java.lang.String s,
boolean flush)
|
Methods inherited from class ch.qos.logback.core.WriterAppender |
---|
append, closeWriter, createWriter, getEncoding, getImmediateFlush, setEncoding, setImmediateFlush, setWriter, stop, subAppend |
Methods inherited from class ch.qos.logback.core.UnsynchronizedAppenderBase |
---|
addFilter, clearAllFilters, doAppend, getCopyOfAttachedFiltersList, getFilterChainDecision, getFirstFilter, getLayout, getName, isStarted, setLayout, setName, toString |
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface ch.qos.logback.core.spi.ContextAware |
---|
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, setContext |
Field Detail |
---|
protected boolean append
true
, meaning that by default a FileAppender
will append to an existing file and not truncate it.
protected java.lang.String fileName
protected boolean bufferedIO
protected int bufferSize
Constructor Detail |
---|
public FileAppender()
Method Detail |
---|
public void setFile(java.lang.String file)
public boolean getAppend()
public boolean isAppend()
public final java.lang.String rawFileProperty()
public java.lang.String getFile()
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.
start
in interface LifeCycle
start
in class WriterAppender<E>
public void openFile(java.lang.String file_name) throws java.io.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().
filename
- The path to the log file.append
- If true will append to fileName. Otherwise will truncate
fileName.bufferedIO
- bufferSize
-
java.io.IOException
public boolean isBufferedIO()
public void setBufferedIO(boolean bufferedIO)
public int getBufferSize()
public void setBufferSize(int bufferSize)
public boolean isPrudent()
setPrudent(boolean)
public void setPrudent(boolean prudent)
prudent
- public void setAppend(boolean append)
protected void writerWrite(java.lang.String s, boolean flush) throws java.io.IOException
writerWrite
in class WriterAppender<E>
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |