Save This Page
Home » apache-log4j-1.2.15 » org.apache » log4j » net » [javadoc | source]
org.apache.log4j.net
public class: SocketHubAppender [javadoc | source]
java.lang.Object
   org.apache.log4j.AppenderSkeleton
      org.apache.log4j.net.SocketHubAppender

All Implemented Interfaces:
    OptionHandler, Appender

Sends LoggingEvent objects to a set of remote log servers, usually a SocketNodes .

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:

Field Summary
static final  int DEFAULT_PORT    The default port number of the ServerSocket will be created on. 
Fields inherited from org.apache.log4j.AppenderSkeleton:
layout,  name,  threshold,  errorHandler,  headFilter,  tailFilter,  closed
Constructor:
 public SocketHubAppender() 
 public SocketHubAppender(int _port) 
Method from org.apache.log4j.net.SocketHubAppender Summary:
activateOptions,   append,   cleanUp,   close,   getLocationInfo,   getPort,   requiresLayout,   setLocationInfo,   setPort
Methods from org.apache.log4j.AppenderSkeleton:
activateOptions,   addFilter,   append,   clearFilters,   doAppend,   finalize,   getErrorHandler,   getFilter,   getFirstFilter,   getLayout,   getName,   getThreshold,   isAsSevereAsThreshold,   setErrorHandler,   setLayout,   setName,   setThreshold
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.net.SocketHubAppender Detail:
 public  void activateOptions() 
    Set up the socket server on the specified port.
 public  void append(LoggingEvent event) 
    Append an event to all of current connections.
 public  void cleanUp() 
    Release the underlying ServerMonitor thread, and drop the connections to all connected remote servers.
 public synchronized  void close() 
    Close this appender.

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

 public boolean getLocationInfo() 
    Returns value of the LocationInfo option.
 public int getPort() 
    Returns value of the Port option.
 public boolean requiresLayout() 
    The SocketHubAppender does not use a layout. Hence, this method returns false.
 public  void setLocationInfo(boolean _locationInfo) 
    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.
 public  void setPort(int _port) 
    The Port option takes a positive integer representing the port where the server is waiting for connections.