On Nov 27, 2006, at 6:08 PM, Stephen Bartnikowski wrote:

Hello,

I'm doing the following:

std::string message;

[...]

if (sm_logger->isDebugEnabled()) {
   log4cxx::logstream oss(sm_logger, log4cxx::Level::getDebug());
   oss.setLocation(LOG4CXX_LOCATION);
   oss << message;
   oss.flush();
}

but in one circumstance I found that "message" contained actual zeros
as part of the string data.  (std::string allows this and does not
recognize them as null terminators.)

When "message" is streamed into "oss", my program hangs.  If I convert
"message" to a c_str prior to calling my block of code, everything runs fine. I think the logstream operator<< is converting the std::string to
a type that isn't able to handle zeros in the string for whatever
reason.  Should this be a bug report?

(I'm using the log4cxx code from SVN about 2 weeks ago on FreeBSD 6.0.)

Thanks!
Steve


Already reported as http://issues.apache.org/jira/browse/LOGCXX-162. There is a patch associated with the bug report, but it has not been reviewed.

Reply via email to