I am working on client server application.we have protocol format to send and query data from Server. Now I need to log the data coming from or to server on the log file. I am using latest version of Log4cxx. But this binary data contains null character as well.
one message lokks like this:
ab 40 01 00 00 00 ff f0 00 00 00 00 09 01 01 07 00 00 c0 a8 04 54 ae.
first I tried with char* pMsg then I did somethig like this using std string str(pMsg ) both are not working .
then i did something like this
char chMsg[MAX_PATH];
while(i<nBuffLen)
{
chMsg[i] = *(pMsgBuff+i);
i++;
}
All the approach fails to work and the result is
- it is printing first three bytes correctly and none after that.
- Some time call to LOG4CXX_INFO crashes the application.
I am using LOG4CXX_INFO macro to log the info.
It seems it is due to NULL character in the fourth field. i have found this link which claim to be resolved the issue but I tried the same code with LOG4CXX_INFO it is crashing. https://issues.apache.org/jira/browse/LOGCXX-162
Hoe to resolve this issue?