- Main Page
- Modules
- Namespaces
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# SyslogAppender Class Reference

Inherits AppenderSkeleton.

List of all members.

## Detailed Description

Use SyslogAppender to send log messages to a remote syslog daemon.

## Public Member Functions

| SyslogAppender ()
| SyslogAppender (const LayoutPtr &layout, int syslogFacility)
| SyslogAppender (const LayoutPtr &layout, const LogString &syslogHost, int syslogFacility)
| ~SyslogAppender ()
void | close ()
| Release any resources held by this SyslogAppender.
void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p)
| Subclasses of `AppenderSkeleton` should implement this method to perform actual logging.
void | activateOptions (log4cxx::helpers::Pool &p)
| This method returns immediately as options are activated when they are set.
void | setOption (const LogString &option, const LogString &value)
| Set `option` to `value`.
virtual bool | requiresLayout () const
| The SyslogAppender requires a layout.
void | setSyslogHost (const LogString &syslogHost)
| The SyslogHost option is the name of the the syslog host where log output should go.
const LogString & | getSyslogHost () const
| Returns the value of the SyslogHost option.
void | setFacility (const LogString &facilityName)
| Set the syslog facility.
LogString | getFacility () const
| Returns the value of the Facility option.
void | setFacilityPrinting (bool facilityPrinting1)
| If the FacilityPrinting option is set to true, the printed message will include the facility name of the application.
bool | getFacilityPrinting () const
| Returns the value of the FacilityPrinting option.

## Static Public Member Functions

static LogString | getFacilityString (int syslogFacility)
| Returns the specified syslog facility as a lower-case String, e.g.
static int | getFacility (const LogString &facilityName)
| Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized.

## Protected Member Functions

void | initSyslogFacilityStr ()

## Protected Attributes

int | syslogFacility
LogString | facilityStr
bool | facilityPrinting
helpers::SyslogWriter * | sw
LogString | syslogHost

## Constructor & Destructor Documentation

SyslogAppender | ( |  | ) |

SyslogAppender | ( | const LayoutPtr & | layout,
|  | int | syslogFacility
| ) |

SyslogAppender | ( | const LayoutPtr & | layout,
|  | const LogString & | syslogHost,
|  | int | syslogFacility
| ) |

~SyslogAppender | ( |  | ) |

## Member Function Documentation

void activateOptions | ( | log4cxx::helpers::Pool & | p | ) | `[virtual]`

| This method returns immediately as options are activated when they are set. Reimplemented from AppenderSkeleton.

void append | ( | const spi::LoggingEventPtr & | event,
|  | log4cxx::helpers::Pool & | p
| ) | `[virtual]`

| Subclasses of `AppenderSkeleton` should implement this method to perform actual logging. See also AppenderSkeleton::doAppend method. Implements AppenderSkeleton.

void close | ( |  | ) | `[virtual]`

| Release any resources held by this SyslogAppender. Implements Appender.

LogString getFacility | ( |  | ) | const`[inline]`

| Returns the value of the Facility option.

static int getFacility | ( | const LogString & | facilityName | ) | `[static]`

| Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized.

Parameters:

  | facilityName | one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. The matching is case-insensitive.

bool getFacilityPrinting | ( |  | ) | const`[inline]`

| Returns the value of the FacilityPrinting option.

static LogString getFacilityString | ( | int | syslogFacility | ) | `[static]`

| Returns the specified syslog facility as a lower-case String, e.g. "kern", "user", etc.

const LogString& getSyslogHost | ( |  | ) | const`[inline]`

| Returns the value of the SyslogHost option.

void initSyslogFacilityStr | ( |  | ) | `[protected]`

virtual bool requiresLayout | ( |  | ) | const`[inline, virtual]`

| The SyslogAppender requires a layout. Hence, this method returns `true`. Implements Appender.

void setFacility | ( | const LogString & | facilityName | ) |

| Set the syslog facility. This is the Facility option. The `facilityName` parameter must be one of the strings KERN, USER, MAIL, DAEMON, AUTH, SYSLOG, LPR, NEWS, UUCP, CRON, AUTHPRIV, FTP, LOCAL0, LOCAL1, LOCAL2, LOCAL3, LOCAL4, LOCAL5, LOCAL6, LOCAL7. Case is unimportant.

void setFacilityPrinting | ( | bool | facilityPrinting1 | ) | `[inline]`

| If the FacilityPrinting option is set to true, the printed message will include the facility name of the application. It is false by default.

void setOption | ( | const LogString & | option,
|  | const LogString & | value
| ) | `[virtual]`

| Set `option` to `value`. The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when activateOptions is called. Reimplemented from AppenderSkeleton.

void setSyslogHost | ( | const LogString & | syslogHost | ) |

| The SyslogHost option is the name of the the syslog host where log output should go. WARNING If the SyslogHost is not set, then this appender will fail.

## Member Data Documentation

bool facilityPrinting`[protected]`

LogString facilityStr`[protected]`

helpers::SyslogWriter* sw`[protected]`

int syslogFacility`[protected]`

LogString syslogHost`[protected]`

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

- syslogappender.h