Here's how:

ObjectInputStream ois = new ObjectInputStream(new
BufferedInputStream(socket.getInputStream()));

[...]

LoggingEvent incomingEvent = (LoggingEvent) ois.readObject(); 
System.out.println("My log message was: " + incomingEvent.getMessage());
System.out.println("Its level was: " + incomingEvent.level.toString());


Hope that helps,
Todd.

> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Rakesh Patel
> Sent: Wednesday, September 21, 2005 3:29 PM
> To: log4j-user@logging.apache.org
> Subject: Using the SocketHubAppender - Reading off the socket 
> 
> Here is the scenario:
> 
> 1. Program A is published its log4j messages via a 
> SocketHubAppender on port X.
> 
> 2. I have written a program where I connect to the socket on 
> port X. I am using the standard Java socket API. 
> 
> I am able successfully able to connect to port X and read the 
> socket, but the problem is I am unable to probably decode the 
> message. How do I transform the received data on the socket 
> to readable ASCII? Most of the data is unreadable characters. 
> I can make out only some of the string.
> 
> Thanks
> 
> Rakesh  
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to