Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

SyslogAppender Class Reference

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

Inherits log4cxx::AppenderSkeleton.

List of all members.

Classes

class  ClazzSyslogAppender

Public Member Functions

virtual const helpers::ClassgetClass () const
const void * cast (const helpers::Class &clazz) const
bool instanceof (const helpers::Class &clazz) const
 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)
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 LogStringgetSyslogHost () 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 const helpers::ClassgetStaticClass ()
static const
log4cxx::helpers::ClassRegistration
registerClass ()
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::SyslogWritersw
LogString syslogHost

Detailed Description

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


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.

const void* cast ( const helpers::Class clazz  )  const [inline, virtual]

Implements Object.

void close (  ) 

Release any resources held by this SyslogAppender.

virtual const helpers::Class& getClass (  )  const [virtual]

Reimplemented from Object.

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.

static const helpers::Class& getStaticClass (  )  [static]

Reimplemented from Object.

const LogString& getSyslogHost (  )  const [inline]

Returns the value of the SyslogHost option.

void initSyslogFacilityStr (  )  [protected]
bool instanceof ( const helpers::Class clazz  )  const [inline, virtual]

Implements Object.

static const log4cxx::helpers::ClassRegistration& registerClass (  )  [static]

Reimplemented from Object.

virtual bool requiresLayout (  )  const [inline, virtual]

The SyslogAppender requires a layout.

Hence, this method returns true.

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]

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: