log4cpp  1.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes
log4cpp::SyslogAppender Class Reference

SyslogAppender sends LoggingEvents to the local syslog system. More...

#include <SyslogAppender.hh>

Inheritance diagram for log4cpp::SyslogAppender:
log4cpp::LayoutAppender log4cpp::AppenderSkeleton log4cpp::Appender

List of all members.

Public Member Functions

 SyslogAppender (const std::string &name, const std::string &syslogName, int facility=LOG_USER)
 Instantiate a SyslogAppender with given name and name and facility for syslog.
virtual ~SyslogAppender ()
virtual bool reopen ()
 Calls closelog(3) and openlog(3).
virtual void close ()
 Calls closelog(3) to close the syslog file descriptor.
- Public Member Functions inherited from log4cpp::LayoutAppender
 LayoutAppender (const std::string &name)
virtual ~LayoutAppender ()
virtual bool requiresLayout () const
 Check if the appender requires a layout.
virtual void setLayout (Layout *layout=NULL)
 Set the Layout for this appender.
- Public Member Functions inherited from log4cpp::AppenderSkeleton
virtual ~AppenderSkeleton ()
 Destructor for AppenderSkeleton.
virtual void doAppend (const LoggingEvent &event)
 Log in Appender specific way.
virtual void setThreshold (Priority::Value priority)
 Set the threshold priority of this Appender.
virtual Priority::Value getThreshold ()
 Get the threshold priority of this Appender.
virtual void setFilter (Filter *filter)
 Set a Filter for this appender.
virtual FiltergetFilter ()
 Get the Filter for this appender.
- Public Member Functions inherited from log4cpp::Appender
virtual ~Appender ()
 Destructor for Appender.
const std::string & getName () const
 Get the name of this appender.

Static Public Member Functions

static int toSyslogPriority (Priority::Value priority)
 Translates a log4cpp priority to a syslog priority.

Protected Member Functions

virtual void open ()
 Calls openlog(3).
virtual void _append (const LoggingEvent &event)
 Sends a LoggingEvent to syslog.
- Protected Member Functions inherited from log4cpp::LayoutAppender
Layout_getLayout ()
 Return the layout of the appender.
- Protected Member Functions inherited from log4cpp::AppenderSkeleton
 AppenderSkeleton (const std::string &name)
 Constructor for AppenderSkeleton.
- Protected Member Functions inherited from log4cpp::Appender
 Appender (const std::string &name)
 Constructor for Appender.

Protected Attributes

const std::string _syslogName
int _facility

Additional Inherited Members

- Public Types inherited from log4cpp::LayoutAppender
typedef BasicLayout DefaultLayoutType

Detailed Description

SyslogAppender sends LoggingEvents to the local syslog system.


Constructor & Destructor Documentation

log4cpp::SyslogAppender::SyslogAppender ( const std::string &  name,
const std::string &  syslogName,
int  facility = LOG_USER 
)

Instantiate a SyslogAppender with given name and name and facility for syslog.

Note that the C syslog API is process global, so instantion of a second SyslogAppender will 'overwrite' the syslog name of the first.

Parameters:
nameThe name of the Appender
syslogNameThe ident parameter in the openlog(3) call.
facilityThe syslog facility to log to. Defaults to LOG_USER.
virtual log4cpp::SyslogAppender::~SyslogAppender ( )
virtual

Member Function Documentation

virtual void log4cpp::SyslogAppender::_append ( const LoggingEvent event)
protectedvirtual

Sends a LoggingEvent to syslog.

Parameters:
eventthe LoggingEvent to log.

Implements log4cpp::AppenderSkeleton.

virtual void log4cpp::SyslogAppender::close ( )
virtual

Calls closelog(3) to close the syslog file descriptor.

Implements log4cpp::AppenderSkeleton.

virtual void log4cpp::SyslogAppender::open ( )
protectedvirtual

Calls openlog(3).

virtual bool log4cpp::SyslogAppender::reopen ( )
virtual

Calls closelog(3) and openlog(3).

Reimplemented from log4cpp::AppenderSkeleton.

static int log4cpp::SyslogAppender::toSyslogPriority ( Priority::Value  priority)
static

Translates a log4cpp priority to a syslog priority.

Parameters:
priorityThe log4cpp priority.
Returns:
the syslog priority.

Member Data Documentation

int log4cpp::SyslogAppender::_facility
protected
const std::string log4cpp::SyslogAppender::_syslogName
protected

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