# log4cplus::FileAppender Class Reference

Appends log events to a file. More...

`#include <fileappender.h>`

Inheritance diagram for log4cplus::FileAppender:

[legend]
Collaboration diagram for log4cplus::FileAppender:

[legend]
List of all members.

## Public Member Functions

| FileAppender (const log4cplus::tstring &filename, LOG4CPLUS_OPEN_MODE_TYPE mode=LOG4CPLUS_FSTREAM_NAMESPACE::ios::trunc, bool immediateFlush=true)
| FileAppender (const log4cplus::helpers::Properties &properties, LOG4CPLUS_OPEN_MODE_TYPE mode=LOG4CPLUS_FSTREAM_NAMESPACE::ios::trunc)
virtual | ~FileAppender ()
virtual void | close ()
| Release any resources allocated within the appender such as file handles, network connections, etc.

## Protected Member Functions

virtual void | append (const spi::InternalLoggingEvent &event)

## Protected Attributes

bool | immediateFlush
| Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation.
log4cplus::tofstream | out
log4cplus::tstring | filename

## Detailed Description

Appends log events to a file.

Definition at line 35 of file fileappender.h.

## Constructor & Destructor Documentation

log4cplus::FileAppender::FileAppender | ( | const log4cplus::tstring & | filename,
|  | LOG4CPLUS_OPEN_MODE_TYPE | mode = LOG4CPLUS_FSTREAM_NAMESPACE::ios::trunc,
|  | bool | immediateFlush = true
| ) |

log4cplus::FileAppender::FileAppender | ( | const log4cplus::helpers::Properties & | properties,
|  | LOG4CPLUS_OPEN_MODE_TYPE | mode = LOG4CPLUS_FSTREAM_NAMESPACE::ios::trunc
| ) |

virtual log4cplus::FileAppender::~FileAppender | ( |  | ) | `[virtual]`

## Member Function Documentation

virtual void log4cplus::FileAppender::append | ( | const spi::InternalLoggingEvent & | event | ) | `[protected, virtual]`

| Reimplemented in log4cplus::RollingFileAppender, and log4cplus::DailyRollingFileAppender.

virtual void log4cplus::FileAppender::close | ( |  | ) | `[virtual]`

| Release any resources allocated within the appender such as file handles, network connections, etc. It is a programming error to append to a closed appender. Implements log4cplus::Appender. Reimplemented in log4cplus::DailyRollingFileAppender.

## Member Data Documentation

log4cplus::tstring log4cplus::FileAppender::filename `[protected]`

| Definition at line 69 of file fileappender.h.

bool log4cplus::FileAppender::immediateFlush `[protected]`

Immediate flush means that the underlying writer or output stream will be flushed at the end of each append operation.

Immediate flush is slower but ensures that each append request is actually written. If `immediateFlush` is set to `false`, then there is a good chance that the last few logs events are not actually written to persistent media if and when the application crashes.

The `immediateFlush` variable is set to `true` by default.

Definition at line 66 of file fileappender.h.

log4cplus::tofstream log4cplus::FileAppender::out `[protected]`

| Definition at line 68 of file fileappender.h.

The documentation for this class was generated from the following file:

- fileappender.h