void SocketAppender::append(const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& p) {
    if (oos != 0) {
        LogString ndcVal;
        event->getNDC(ndcVal);
        event->getThreadName();
        // Get a copy of this thread's MDC.
        event->getMDCCopy();
        try {
           event->write(*oos, p);
           oos->flush(p);
        } catch(std::exception& e) {
           oos = 0;
           LogLog::warn(LOG4CXX_STR("Detected problem with connection: "), e);
           if (getReconnectionDelay() > 0) {
               fireConnector();
           }
        }
    }
}
void SocketHubAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{

        // if no open connections, exit now
        if(streams.empty())
        {
                return;
        }
        
        LogString ndcVal;
        event->getNDC(ndcVal);
        event->getThreadName();
        // Get a copy of this thread's MDC.
        event->getMDCCopy();
       

        // loop through the current set of open connections, appending the event to each
        std::vector<ObjectOutputStreamPtr>::iterator it = streams.begin();
        std::vector<ObjectOutputStreamPtr>::iterator itEnd = streams.end();
        while(it != itEnd)
        {
                // list size changed unexpectedly? Just exit the append.
                if (*it == 0)
                {
                        break;
                }

                try
                {
                        event->write(**it, p);
                        (*it)->flush(p);
                        it++;
                }
                catch(std::exception& e)
                {
                        // there was an io exception so just drop the connection
                        it = streams.erase(it);
                        LogLog::debug(LOG4CXX_STR("dropped connection"), e);
                }
        }
}