Logback API
Version 0.9.8

ch.qos.logback.core
Class FileAppender<E>

java.lang.Object
  extended by ch.qos.logback.core.spi.ContextAwareBase
      extended by ch.qos.logback.core.AppenderBase<E>
          extended by ch.qos.logback.core.WriterAppender<E>
              extended by ch.qos.logback.core.FileAppender<E>
All Implemented Interfaces:
Appender<E>, ContextAware, FilterAttachable, LifeCycle
Direct Known Subclasses:
RollingFileAppender

public class FileAppender<E>
extends WriterAppender<E>

FileAppender appends log events to a file. For more informatio about this appender, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#FileAppender

Author:
Ceki Gülcü

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  String fileName
          The name of the active log file.
 
Fields inherited from class ch.qos.logback.core.WriterAppender
encoding, immediateFlush, layout, writer
 
Fields inherited from class ch.qos.logback.core.AppenderBase
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()
          Returns the value of the Append option.
 int getBufferSize()
           
 String getFile()
          Returns the value of the File option.
 boolean isBufferedIO()
           
 void setAppend(boolean append)
           
 void setBufferedIO(boolean bufferedIO)
           
 void setBufferSize(int bufferSize)
           
 void setFile()
           Sets and opens the file where the log output will go.
 void setFile(String file)
          The File property takes a string value which should be the name of the file to append to.
 void start()
          If the value of File is not null, then setFile(java.lang.String) is called with the values of File and Append properties.
 
Methods inherited from class ch.qos.logback.core.WriterAppender
append, closeWriter, createWriter, getEncoding, getImmediateFlush, getLayout, setEncoding, setImmediateFlush, setLayout, setWriter, stop, subAppend
 
Methods inherited from class ch.qos.logback.core.AppenderBase
addFilter, clearAllFilters, doAppend, getFilterChainDecision, getFirstFilter, getName, isStarted, setName, toString
 
Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, 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

append

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.


fileName

protected String fileName
The name of the active log file.


bufferedIO

protected boolean bufferedIO
Do we do bufferedIO?


bufferSize

protected int bufferSize
The size of the IO buffer. Default is 8K.

Constructor Detail

FileAppender

public FileAppender()
As in most cases, the default constructor does nothing.

Method Detail

setFile

public void setFile(String file)
The File property takes a string value which should be the name of the file to append to.


getAppend

public boolean getAppend()
Returns the value of the Append option.


getFile

public String getFile()
Returns the value of the File option.


start

public void start()
If the value of File is not null, then setFile(java.lang.String) is called with the values of File and Append properties.

Specified by:
start in interface LifeCycle
Overrides:
start in class WriterAppender<E>

setFile

public void setFile()
             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().

Parameters:
filename - The path to the log file.
append - If true will append to fileName. Otherwise will truncate fileName.
bufferedIO -
bufferSize -
Throws:
IOException

isBufferedIO

public boolean isBufferedIO()

setBufferedIO

public void setBufferedIO(boolean bufferedIO)

getBufferSize

public int getBufferSize()

setBufferSize

public void setBufferSize(int bufferSize)

setAppend

public void setAppend(boolean append)

Logback API
Version 0.9.8

Copyright © 2005-2008 QOS.ch. All Rights Reserved.