FileDocCategorySizeDatePackage
LoggingReceiver.javaAPI DocApache log4j 1.2.154286Sat Aug 25 00:09:40 BST 2007org.apache.log4j.chainsaw

LoggingReceiver

public class LoggingReceiver extends Thread
A daemon thread the processes connections from a org.apache.log4j.net.SocketAppender.html.
author
Oliver Burn

Fields Summary
private static final Logger
LOG
used to log messages
private MyTableModel
mModel
where to put the events
private ServerSocket
mSvrSock
server for listening for connections
Constructors Summary
LoggingReceiver(MyTableModel aModel, int aPort)
Creates a new LoggingReceiver instance.

param
aModel model to place put received into
param
aPort port to listen on
throws
IOException if an error occurs

        setDaemon(true);
        mModel = aModel;
        mSvrSock = new ServerSocket(aPort);
    
Methods Summary
public voidrun()
Listens for client connections

        LOG.info("Thread started");
        try {
            while (true) {
                LOG.debug("Waiting for a connection");
                final Socket client = mSvrSock.accept();
                LOG.debug("Got a connection from " +
                          client.getInetAddress().getHostName());
                final Thread t = new Thread(new Slurper(client));
                t.setDaemon(true);
                t.start();
            }
        } catch (IOException e) {
            LOG.error("Error in accepting connections, stopping.", e);
        }