SocketHubAppender Class Reference

Inheritance diagram for SocketHubAppender:

AppenderSkeleton Appender ObjectImpl OptionHandler Object Object List of all members.

Public Member Functions

 SocketHubAppender (int port)
virtual void activateOptions ()
virtual void setOption (const String &option, const String &value)
virtual void close ()
void cleanUp ()
virtual void append (const spi::LoggingEventPtr &event)
virtual bool requiresLayout () const
void setPort (int port)
int getPort () const
void setLocationInfo (bool locationInfo)
bool getLocationInfo () const

Detailed Description

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:


Constructor & Destructor Documentation

SocketHubAppender ( int  port  ) 

Connects to remote server at address and port.


Member Function Documentation

void activateOptions (  )  [virtual]

Set up the socket server on the specified port.

Reimplemented from AppenderSkeleton.

void append ( const spi::LoggingEventPtr event  )  [virtual]

Append an event to all of current connections.

Implements AppenderSkeleton.

void cleanUp (  ) 

Release the underlying ServerMonitor thread, and drop the connections to all connected remote servers.

void close (  )  [virtual]

Close this appender.

This will mark the appender as closed and call then cleanUp method.

Implements Appender.

bool getLocationInfo (  )  const [inline]

Returns value of the LocationInfo option.

int getPort (  )  const [inline]

Returns value of the Port option.

virtual bool requiresLayout (  )  const [inline, virtual]

The SocketHubAppender does not use a layout. Hence, this method returns false.

Implements Appender.

void setLocationInfo ( bool  locationInfo  )  [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.

void setOption ( const String &  option,
const String &  value 
) [virtual]

Set options

Reimplemented from AppenderSkeleton.

void setPort ( int  port  )  [inline]

The Port option takes a positive integer representing the port where the server is waiting for connections.


The documentation for this class was generated from the following files:
Generated on Sat Feb 9 16:52:11 2008 for log4cxx by  doxygen 1.4.7