logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rizwan khalid <rizwankha...@infinilogic.com>
Subject Re: Server side socket usage
Date Sat, 17 May 2008 11:47:08 GMT
<P><BR>Hi</P>
<P>Few months back Amit Sarna sent me a working example for client/server
loggers. It uses SockeAppender but it should be easily converted to <FONT
face="Courier New">XMLSocketAppender</FONT>. Below i am pasting the Amit's
email which will help you in building the sample attached with this
mail...</P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">Hi Rizwan,</SPAN><SPAN style="mso-fareast-font-family:
'Times New Roman'"><?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">&nbsp; Sorry for delayed response. This is my work e-mail
so can't see it on weekends. I've attached the source and config files in a
.RAR file.&nbsp; It's a very simple example but enough to show how to do a
client and a server. I haven't included&nbsp;make files because our
makefiles use a lot of environment vars specific to our app but if you can't
get it compiling i can try and rustle one up for you tonight. </SPAN><SPAN
style="mso-fareast-font-family: 'Times New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="mso-fareast-font-family: 'Times New Roman'"><FONT size=3><FONT
face="Times New Roman">&nbsp;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">The config files should be in the same directory as the
executables. When you've compiled both, run the server first, then run the
client. This should produce two log files, the client one should log as
expected, and the server one should log it's own stuff and also messages
sent from the client app.</SPAN><SPAN style="mso-fareast-font-family: 'Times
New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="mso-fareast-font-family: 'Times New Roman'"><FONT size=3><FONT
face="Times New Roman">&nbsp;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">If you need any explanation on anything drop me a mail
and i'll do my best :-)</SPAN><SPAN style="mso-fareast-font-family: 'Times
New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN
style="mso-fareast-font-family: 'Times New Roman'"><FONT size=3><FONT
face="Times New Roman">&nbsp;<o:p></o:p></FONT></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">Cheers</SPAN><SPAN style="mso-fareast-font-family: 'Times
New Roman'"><o:p></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0in 0in 0pt"><SPAN style="FONT-SIZE: 10pt;
COLOR: blue; FONT-FAMILY: 'Arial','sans-serif'; mso-fareast-font-family:
'Times New Roman'">&nbsp; Amit </SPAN><SPAN style="mso-fareast-font-family:
'Times New Roman'"><o:p></o:p></SPAN></P>
<P><BR>--<BR>Rizwan Khalid<BR>Phone: +92 021 2781592<BR>14th
Floor, National
IT Park, Shahra-e-Faisal<BR>Karachi, Pakistan<BR><BR></P>
<P><BR>&nbsp;</P>
<BLOCKQUOTE dir=ltr style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px;
MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">--------- Original message --------<BR>From:
"Curt Arnold" <CARNOLD@APACHE.ORG><BR>To: "Log4CXX User"
<LOG4CXX-USER@LOGGING.APACHE.ORG><BR>Subject: [SPAM] Re: Server side socket
usage<BR>Date: 05-16-08 01:17<BR><BR><FONT face="Courier New" size=2><BR>On
May 15, 2008, at 9:45 AM, Ruud Bos wrote:<BR><BR>&gt; Hello,<BR>&gt;<BR>&gt;
I'm new to the list, so I have no idea if this question has been <BR>&gt;
asked many times before. I hope someone can put me in the right <BR>&gt;
direction.<BR>&gt;<BR>&gt; I'd like to use log4cxx for two applications.
One
acts as a client <BR>&gt; that needs to send it's logging to a server
application using socket <BR>&gt; communication. Both programs are written
in C++.<BR>&gt;<BR>&gt; From the few things I could find on the internet
about the use of <BR>&gt; the ServerSocket class, I was not able to create
something that <BR>&gt; works. Most of these only talk about the client side
and use the <BR>&gt; java substitute log4j for the server
side.<BR>&gt;<BR>&gt; If someone could point me to some example code,
that
would be <BR>&gt; extremely helpful.<BR>&gt;<BR>&gt; Thanks
in
advance,<BR>&gt; Ruud<BR>&gt;<BR><BR><BR>log4cxx 0.9.7
came with an
implementation of both the client and <BR>server side for SocketAppender,
but used its own format that was not <BR>platform independent. So if the
sender and receiver differed in <BR>endianness, character type, int length
or the like, bad things would <BR>happen.<BR><BR>log4cxx 0.10.0 replaced
that with an implementation that produced a <BR>stream format compatible
with log4j's format (the Java serialization <BR>of its LoggingEvent class).
This allows interoperability with <BR>Chainsaw and eliminated the platform
variation of the format.<BR><BR>There is a huge degree of variability
allowed with Java serialization <BR>so it is much easier to write a logging
event that can be read by Java <BR>serialization than reliably read a
logging event written by Java <BR>serialization. You could write code that
read log4cxx's specific take <BR>on it, but that would be unlikely to
reliably read events from log4j.<BR><BR>If you were going to receive events
from log4cxx, I would suggest <BR>using the XMLSocketAppender as the format
would require less custom <BR>code to parse the stream format. I'm sorry,
but I'm not aware of any <BR>sample code for
it.<BR><BR><BR></FONT></DIV></BLOCKQUOTE>

Mime
View raw message