Dear sir/madam:

I'm a newbie of logcxx. When I using log4cxx::net::SocketHubAppender to send log message to clients, I can not receive any log message.At beginning, I connect the SocketHubAppender at port 4561, and netstat reports that there have already established an connection between client and SocketHubAppender. However, there the report of netstat shows that the Send-Q and Recive-Q are empty forever, and the client was blocked when invoking log4cxx::spi::LoggingEvent::read().

I have searched google and found nothing about this. Can you help me? Thanks.

Sincerely,
Sun Xiaoguang.
Oct. 24th, 2004

Here is my client code. Hope you can help me.

#include <log4cxx/helpers/socket.h>
#include <log4cxx/spi/loggingevent.h>
#include <log4cxx/net/socketnode.h>
#include <log4cxx/helpers/thread.h>
#include <log4cxx/logmanager.h>
#include <iostream>

int main(){
 log4cxx::helpers::SocketPtr __socket;
 log4cxx::spi::LoggingEventPtr __logging_event;
 log4cxx::helpers::SocketInputStreamPtr __input_stream;

 __socket=new log4cxx::helpers::Socket("192.168.123.244",4561);
 __input_stream=__socket->getInputStream();

 while(true){
   __logging_event->read(__input_stream);
   std::cout << __logging_event->getMessage() << std::endl;
 };
 __socket->close();
}

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。 http://www.hotmail.com




Reply via email to