On May 12, 2008, at 9:15 AM, Madhu Gowda wrote:

Hi,

I tried the following in my sample program.
std::string sLogFile = "TestLog.txt";
LogString sFileName;
log4cxx::helpers::Transcoder::decode( sLogFile, sFileName);

But, it gives the sFileName as "".

I tried to debug and saw that in the function
void Transcoder::decode(const std::string& src, LogString& dst) {

the value of src is coming as <Bad Ptr>

Kindly advise on this.

Regards,
Madhu Gowda

The transcoding code is the most sensitive to platform differences. The code path for transcoding on WIndows is very different from on Linux, for example. To really be able to track down anything related to transcoding, it is essential to know the platform, compiler and build options.

Also, you are reporting something regarding a particular debugger's display rendering of a particular STL libraries std::string class. None of that is specific to log4cxx and is very specific to the debugger and STL library in use. It may be that src is perfectly usable, just that it is not being displayed the way you'd like.

Did you run the unit test suite? TimeBasedRollingTest fails occasionally, but all the other tests should pass. If there is a problem with encoding and decoding on your platform, it would likely come up in the unit tests and it would be a lot easier to diagnose and fix.

However, since you don't have any non-ASCII characters in your source string, decoding should be as simple as copying character by character into the destination. What happens when you single step through the code?



Reply via email to