Apache log4cxx
Version 0.11.0
|
Use SyslogAppender to send log messages to a remote syslog daemon. More...
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. More... | |
void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) |
Subclasses of AppenderSkeleton should implement this method to perform actual logging. More... | |
void | activateOptions (log4cxx::helpers::Pool &p) |
This method returns immediately as options are activated when they are set. More... | |
void | setOption (const LogString &option, const LogString &value) |
Set option to value . More... | |
virtual bool | requiresLayout () const |
The SyslogAppender requires a layout. More... | |
void | setSyslogHost (const LogString &syslogHost) |
The SyslogHost option is the name of the the syslog host where log output should go. More... | |
const LogString & | getSyslogHost () const |
Returns the value of the SyslogHost option. More... | |
void | setFacility (const LogString &facilityName) |
Set the syslog facility. More... | |
LogString | getFacility () const |
Returns the value of the Facility option. More... | |
void | setFacilityPrinting (bool facilityPrinting1) |
If the FacilityPrinting option is set to true, the printed message will include the facility name of the application. More... | |
bool | getFacilityPrinting () const |
Returns the value of the FacilityPrinting option. More... | |
Public Member Functions inherited from AppenderSkeleton | |
AppenderSkeleton () | |
AppenderSkeleton (const LayoutPtr &layout) | |
void | addRef () const |
void | releaseRef () const |
void | finalize () |
Finalize this appender by calling the derived class' close method. More... | |
void | addFilter (const spi::FilterPtr &newFilter) |
Add a filter to end of the filter list. More... | |
void | clearFilters () |
Clear the filters chain. More... | |
const spi::ErrorHandlerPtr & | getErrorHandler () const |
Return the currently set spi::ErrorHandler for this Appender. More... | |
spi::FilterPtr | getFilter () const |
Returns the head Filter. More... | |
const spi::FilterPtr & | getFirstFilter () const |
Return the first filter in the filter chain for this Appender. More... | |
LayoutPtr | getLayout () const |
Returns the layout of this appender. More... | |
LogString | getName () const |
Returns the name of this Appender. More... | |
const LevelPtr & | getThreshold () const |
Returns this appenders threshold level. More... | |
bool | isAsSevereAsThreshold (const LevelPtr &level) const |
Check whether the message level is below the appender's threshold. More... | |
virtual void | doAppend (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
This method performs threshold checks and invokes filters before delegating actual logging to the subclasses specific AppenderSkeleton::append method. More... | |
void | setErrorHandler (const spi::ErrorHandlerPtr &eh) |
Set the ErrorHandler for this Appender. More... | |
void | setLayout (const LayoutPtr &layout1) |
Set the layout for this appender. More... | |
void | setName (const LogString &name1) |
Set the name of this Appender. More... | |
void | setThreshold (const LevelPtr &threshold) |
Set the threshold level. More... | |
Public Member Functions inherited from Appender | |
virtual | ~Appender () |
Public Member Functions inherited from OptionHandler | |
virtual | ~OptionHandler () |
Public Member Functions inherited from Object | |
virtual const helpers::Class & | getClass () const |
virtual | ~Object () |
virtual bool | instanceof (const Class &clazz) const =0 |
virtual const void * | cast (const Class &clazz) const =0 |
Public Member Functions inherited from ObjectImpl | |
ObjectImpl () | |
virtual | ~ObjectImpl () |
void | addRef () const |
void | releaseRef () const |
Static Public Member Functions | |
static LogString | getFacilityString (int syslogFacility) |
Returns the specified syslog facility as a lower-case String, e.g. More... | |
static int | getFacility (const LogString &facilityName) |
Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized. More... | |
Static Public Member Functions inherited from Object | |
static const helpers::Class & | getStaticClass () |
static const log4cxx::helpers::ClassRegistration & | registerClass () |
Protected Member Functions | |
void | initSyslogFacilityStr () |
Protected Member Functions inherited from AppenderSkeleton | |
void | doAppendImpl (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
Protected Attributes | |
int | syslogFacility |
LogString | facilityStr |
bool | facilityPrinting |
helpers::SyslogWriter * | sw |
LogString | syslogHost |
int | syslogHostPort |
Protected Attributes inherited from AppenderSkeleton | |
LayoutPtr | layout |
The layout variable does not need to be set if the appender implementation has its own layout. More... | |
LogString | name |
Appenders are named. More... | |
LevelPtr | threshold |
There is no level threshold filtering by default. More... | |
spi::ErrorHandlerPtr | errorHandler |
It is assumed and enforced that errorHandler is never null. More... | |
spi::FilterPtr | headFilter |
The first filter in the filter chain. More... | |
spi::FilterPtr | tailFilter |
The last filter in the filter chain. More... | |
bool | closed |
Is this appender closed? More... | |
log4cxx::helpers::Pool | pool |
SHARED_MUTEX | mutex |
Protected Attributes inherited from ObjectImpl | |
unsigned int volatile | ref |
Use SyslogAppender to send log messages to a remote syslog daemon.
SyslogAppender | ( | ) |
SyslogAppender | ( | const LayoutPtr & | layout, |
int | syslogFacility | ||
) |
SyslogAppender | ( | const LayoutPtr & | layout, |
const LogString & | syslogHost, | ||
int | syslogFacility | ||
) |
~SyslogAppender | ( | ) |
|
virtual |
This method returns immediately as options are activated when they are set.
Reimplemented from AppenderSkeleton.
|
virtual |
Subclasses of AppenderSkeleton
should implement this method to perform actual logging.
See also AppenderSkeleton::doAppend method.
Implements AppenderSkeleton.
|
virtual |
Release any resources held by this SyslogAppender.
Implements Appender.
|
static |
Returns the integer value corresponding to the named syslog facility, or -1 if it couldn't be recognized.
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. |
|
inline |
Returns the value of the Facility option.
|
inline |
Returns the value of the FacilityPrinting option.
|
static |
Returns the specified syslog facility as a lower-case String, e.g.
"kern", "user", etc.
|
inline |
Returns the value of the SyslogHost option.
|
protected |
|
inlinevirtual |
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.
|
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.
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.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |