You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-user@logging.apache.org by Albert Kennis <ak...@star-us.com> on 2005/09/20 17:06:46 UTC

XMLSocketAppender - call to socket->write commented out???

Hello list:

I am trying to use log4cxx to send logging events to Chainsaw V2 via the XMLSocketAppender channel.  Building the 0.9.8 source results in socket connections being made, but not in log event data being sent.

I have located the source of this problem:  the following 2 lines are commented out in XMLSocketAppender::renderEvent:

//USES_CONVERSION;

//os->write((void *)T2A(output.c_str()), output.length());

This results in data not being sent to the socket.

Looking through the rest of the project, I can see that anywhere the T2A macro is used, that portion of code is commented out.  I'm have not been able to locate the T2A definition, and so can not guess why its usage is being avoided.

If the following code is placed in XMLSocketAppender::renderEvent, the log events will be transmitted (and received) successfully by Chainsaw V2:

        char * sz = (char *) malloc(output.length() + 1);

        sprintf(sz, "%S", output.c_str());

        os->write((void *)sz, output.length());

        free(sz);

I'm fairly certain there is a good reason why T2A usage is being avoided, I just don't know why.  In the absence of that knowledge all I can claim is that the above code makes the XMLSocketAppender functional with respect to log events being received by Chainsaw V2; I can not make any claim about this code's correctness with respect to other aspects of the log4cxx architecture.

The ability to send log events remotely via the XMLSocketAppender is very valueable, and I hope this functionality can be enabled properly on the projects trunk and subsequent releases.

Thank you,


Albert Kennis
Software Engineer
POS & Kiosk Printer Products
Star Micronics

Tel: +81-543-47-0111
Fax: +81-543-48-9560


Re: XMLSocketAppender - call to socket->write commented out???

Posted by Curt Arnold <ca...@houston.rr.com>.
> I'm fairly certain there is a good reason why T2A usage is being  
> avoided, I just don't know why.  In the absence of that knowledge  
> all I can claim is that the above code makes the XMLSocketAppender  
> functional with respect to log events being received by Chainsaw  
> V2; I can not make any claim about this code's correctness with  
> respect to other aspects of the log4cxx architecture.
>

log4cxx-0.9.7 supported either the default single char code page or  
wchar_t but not both simultaneously.  The T2A and tchar type are  
artifacts of the Microsoft approach for the transition from single  
char API (Win 3.1 and 9x code bases) and wchar_t API (Win NT, 2000  
and XP).


> The ability to send log events remotely via the XMLSocketAppender  
> is very valueable, and I hope this functionality can be enabled  
> properly on the projects trunk and subsequent releases.
>
> Thank you,

With the migration from the single character type approach to the  
current flexible approach, a decent amount of code needed to be  
commented out until it could be fixed.  I thought that  
XMLSocketAppender was back on line, but could have been mistaken,