Apache log4cxx
Version 0.13.0
|
Sends LoggingEvent objects to a set of remote log servers, usually a SocketNode. More...
#include <sockethubappender.h>
Public Member Functions | |
SocketHubAppender () | |
~SocketHubAppender () | |
SocketHubAppender (int port) | |
Connects to remote server at address and port . More... | |
virtual void | activateOptions (log4cxx::helpers::Pool &p) |
Set up the socket server on the specified port. More... | |
virtual void | setOption (const LogString &option, const LogString &value) |
Set options. More... | |
virtual void | close () |
Release any resources allocated within the appender such as file handles, network connections, etc. More... | |
virtual void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) |
Append an event to all of current connections. More... | |
virtual bool | requiresLayout () const |
The SocketHubAppender does not use a layout. More... | |
void | setPort (int port1) |
The Port option takes a positive integer representing the port where the server is waiting for connections. More... | |
int | getPort () const |
Returns value of the Port option. More... | |
void | setLocationInfo (bool locationInfo1) |
The LocationInfo option takes a boolean value. More... | |
bool | getLocationInfo () const |
Returns value of the LocationInfo option. More... | |
Public Member Functions inherited from log4cxx::AppenderSkeleton | |
AppenderSkeleton () | |
AppenderSkeleton (const LayoutPtr &layout) | |
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 log4cxx::Appender | |
virtual | ~Appender () |
void | asdf () |
Public Member Functions inherited from log4cxx::spi::OptionHandler | |
virtual | ~OptionHandler () |
Public Member Functions inherited from log4cxx::helpers::Object | |
virtual | ~Object () |
virtual bool | instanceof (const Class &clazz) const =0 |
virtual const void * | cast (const Class &clazz) const =0 |
Additional Inherited Members | |
Protected Member Functions inherited from log4cxx::AppenderSkeleton | |
void | doAppendImpl (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &pool) |
Protected Attributes inherited from log4cxx::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 |
std::recursive_mutex | mutex |
Sends LoggingEvent objects to a set of remote log servers, usually a SocketNode.
Acts just like SocketAppender except that instead of connecting to a given remote log server, SocketHubAppender
accepts connections from the remote log servers as clients. It can accept more than one connection. When a log event is received, the event is sent to the set of currently connected remote log servers. Implemented this way it does not require any update to the configuration file to send data to another remote log server. The remote log server simply connects to the host and port the SocketHubAppender
is running on.
The SocketHubAppender
does not store events such that the remote side will events that arrived after the establishment of its connection. Once connected, events arrive in order as guaranteed by the TCP protocol.
This implementation borrows heavily from the SocketAppender.
The SocketHubAppender has the following characteristics:
SocketHubAppender
does not use a layout. It ships a serialized spi::LoggingEvent object to the remote side.SocketHubAppender
relies on the TCP protocol. Consequently, if the remote side is reachable, then log events will eventually arrive at remote client.SocketHubAppender
exits before the SocketHubAppender
is closed either explicitly or subsequent to garbage collection, then there might be untransmitted data in the pipe which might be lost. This is a common problem on Windows based systems. SocketHubAppender
either explicitly or by calling the LogManager::shutdown method before exiting the application. log4cxx::net::SocketHubAppender::SocketHubAppender | ( | ) |
log4cxx::net::SocketHubAppender::~SocketHubAppender | ( | ) |
log4cxx::net::SocketHubAppender::SocketHubAppender | ( | int | port | ) |
Connects to remote server at address
and port
.
|
virtual |
Set up the socket server on the specified port.
Reimplemented from log4cxx::AppenderSkeleton.
|
virtual |
Append an event to all of current connections.
Implements log4cxx::AppenderSkeleton.
|
virtual |
Release any resources allocated within the appender such as file handles, network connections, etc.
It is a programming error to append to a closed appender.
Implements log4cxx::Appender.
|
inline |
Returns value of the LocationInfo option.
|
inline |
Returns value of the Port option.
|
inlinevirtual |
The SocketHubAppender does not use a layout.
Hence, this method returns false
.
Implements log4cxx::Appender.
|
inline |
The LocationInfo option takes a boolean value.
If true, the information sent to the remote host will include location information. By default no location information is sent to the server.
|
virtual |
Set options.
Reimplemented from log4cxx::AppenderSkeleton.
|
inline |
The Port option takes a positive integer representing the port where the server is waiting for connections.