Sends LoggingEvent objects to a set of remote log servers, usually a SocketNode. More...
Inherits log4cxx::AppenderSkeleton.
Classes | |
class | ClazzSocketHubAppender |
Public Member Functions | |
virtual const helpers::Class & | getClass () const |
const void * | cast (const helpers::Class &clazz) const |
bool | instanceof (const helpers::Class &clazz) const |
SocketHubAppender () | |
~SocketHubAppender () | |
SocketHubAppender (int port) | |
Connects to remote server at address and port . | |
virtual void | activateOptions (log4cxx::helpers::Pool &p) |
Set up the socket server on the specified port. | |
virtual void | setOption (const LogString &option, const LogString &value) |
Set options. | |
virtual void | close () |
virtual void | append (const spi::LoggingEventPtr &event, log4cxx::helpers::Pool &p) |
Append an event to all of current connections. | |
virtual bool | requiresLayout () const |
The SocketHubAppender does not use a layout. | |
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. | |
bool | getLocationInfo () const |
Returns value of the LocationInfo option. | |
Static Public Member Functions | |
static const helpers::Class & | getStaticClass () |
static const log4cxx::helpers::ClassRegistration & | registerClass () |
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. ~SocketHubAppender | ( | ) |
SocketHubAppender | ( | int | port | ) |
Connects to remote server at address
and port
.
virtual void activateOptions | ( | log4cxx::helpers::Pool & | p | ) | [virtual] |
Set up the socket server on the specified port.
Reimplemented from AppenderSkeleton.
virtual void append | ( | const spi::LoggingEventPtr & | event, | |
log4cxx::helpers::Pool & | p | |||
) | [virtual] |
Append an event to all of current connections.
Implements AppenderSkeleton.
const void* cast | ( | const helpers::Class & | clazz | ) | const [inline, virtual] |
Implements Object.
virtual void close | ( | ) | [virtual] |
virtual const helpers::Class& getClass | ( | ) | const [virtual] |
Reimplemented from Object.
bool getLocationInfo | ( | ) | const [inline] |
Returns value of the LocationInfo option.
int getPort | ( | ) | const [inline] |
Returns value of the Port option.
static const helpers::Class& getStaticClass | ( | ) | [static] |
Reimplemented from Object.
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 SocketHubAppender does not use a layout.
Hence, this method returns false
.
void setLocationInfo | ( | bool | locationInfo1 | ) | [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.
Set options.
Reimplemented from AppenderSkeleton.
void setPort | ( | int | port1 | ) | [inline] |
The Port option takes a positive integer representing the port where the server is waiting for connections.