Apache log4cxx
Version 0.11.0
|
Sends LoggingEvent objects to a remote a log server, usually Apache Chainsaw. More...
#include <socketappender.h>
Public Member Functions | |
SocketAppender (helpers::InetAddressPtr &address, int port) | |
Connects to remote server at address and port . | |
SocketAppender (const LogString &host, int port) | |
Connects to remote server at host and port . | |
![]() | |
SocketAppenderSkeleton (int defaultPort, int reconnectionDelay) | |
SocketAppenderSkeleton (helpers::InetAddressPtr address, int port, int reconnectionDelay) | |
Connects to remote server at address and port . | |
SocketAppenderSkeleton (const LogString &host, int port, int reconnectionDelay) | |
Connects to remote server at host and port . | |
void | activateOptions (log4cxx::helpers::Pool &p) |
Connect to the specified RemoteHost and Port. | |
void | close () |
Release any resources allocated within the appender such as file handles, network connections, etc. More... | |
bool | requiresLayout () const |
This appender does not use a layout. More... | |
void | setRemoteHost (const LogString &host) |
The RemoteHost option takes a string value which should be the host name of the server where a Apache Chainsaw or compatible is running. | |
const LogString & | getRemoteHost () const |
Returns value of the RemoteHost option. | |
void | setPort (int port1) |
The Port option takes a positive integer representing the port where the server is waiting for connections. | |
int | getPort () const |
Returns value of the Port option. | |
void | setLocationInfo (bool locationInfo1) |
The LocationInfo option takes a boolean value. More... | |
bool | getLocationInfo () const |
Returns value of the LocationInfo option. | |
void | setReconnectionDelay (int reconnectionDelay1) |
The ReconnectionDelay option takes a positive integer representing the number of milliseconds to wait between each failed connection attempt to the server. More... | |
int | getReconnectionDelay () const |
Returns value of the ReconnectionDelay option. | |
void | fireConnector () |
void | setOption (const LogString &option, const LogString &value) |
Set option to value . More... | |
![]() | |
AppenderSkeleton (const LayoutPtr &layout) | |
void | addRef () const |
void | releaseRef () const |
void | finalize () |
Finalize this appender by calling the derived class' close method. | |
void | addFilter (const spi::FilterPtr &newFilter) |
Add a filter to end of the filter list. | |
void | clearFilters () |
Clear the filters chain. | |
const spi::ErrorHandlerPtr & | getErrorHandler () const |
Return the currently set spi::ErrorHandler for this Appender. | |
spi::FilterPtr | getFilter () const |
Returns the head Filter. | |
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. | |
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. | |
void | setErrorHandler (const spi::ErrorHandlerPtr &eh) |
Set the ErrorHandler for this Appender. | |
void | setLayout (const LayoutPtr &layout1) |
Set the layout for this appender. More... | |
void | setName (const LogString &name1) |
Set the name of this Appender. | |
void | setThreshold (const LevelPtr &threshold) |
Set the threshold level. More... | |
![]() | |
virtual bool | instanceof (const Class &clazz) const =0 |
virtual const void * | cast (const Class &clazz) const =0 |
![]() | |
void | addRef () const |
void | releaseRef () const |
Static Public Attributes | |
static int | DEFAULT_PORT |
The default port number of remote logging server (4560). | |
static int | DEFAULT_RECONNECTION_DELAY |
The default reconnection delay (30000 milliseconds or 30 seconds). | |
Protected Member Functions | |
virtual void | setSocket (log4cxx::helpers::SocketPtr &socket, log4cxx::helpers::Pool &p) |
virtual void | cleanUp (log4cxx::helpers::Pool &p) |
virtual int | getDefaultDelay () const |
virtual int | getDefaultPort () const |
void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
Subclasses of AppenderSkeleton should implement this method to perform actual logging. More... | |
![]() | |
void | doAppendImpl (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
Additional Inherited Members | |
![]() | |
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. | |
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? | |
log4cxx::helpers::Pool | pool |
SHARED_MUTEX | mutex |
![]() | |
unsigned int volatile | ref |
Sends LoggingEvent objects to a remote a log server, usually Apache Chainsaw.
The SocketAppender has the following properties:
SocketAppender
is no longer attached to any logger, it will not be destroyed in the presence of a connector thread. A connector thread exists only if the connection to the server is down. To avoid this destruction problem, you should close the the SocketAppender
explicitly. See also next item. SocketAppender
instances should be aware of this destruction problem. Most other applications can safely ignore it.SocketAppender
exits before the SocketAppender
is closed either explicitly or subsequent to destruction, then there might be untransmitted data in the pipe which might be lost. SocketAppender
either explicitly or by calling the LogManager::shutdown method before exiting the application.
|
protectedvirtual |
Subclasses of AppenderSkeleton
should implement this method to perform actual logging.
See also AppenderSkeleton::doAppend method.
Implements log4cxx::AppenderSkeleton.