1

I am trying to run a program in debug mode and using log4cplus to print some message to file. It's running OK in the first seconds. But suddenly interrupt at

_ASSERTE(isleadbyte(_dbcsBuffer(fh)));

I don't know what happened. Why?

Here is part of code

// 写日志 write log
boost::shared_array<byte> msgdata;
size_t msgsize = pReqMsg->msgdata(msgdata);
log4cplus::helpers::SocketBuffer buffer(msgsize);
std::memcpy(buffer.getBuffer() + buffer.getPos(), msgdata.get(), msgsize);
log4cplus::spi::InternalLoggingEvent event2 = cl::readFromBuffer(buffer);
log4cplus::Logger logger;
log4cplus::tstring name = serverID;
if(!log4cplus::Logger::exists(name))
{
    logger = log4cplus::Logger::getInstance(name);
    tpath logpath = CombinePath(logfolder, serverID + CL_TEXT("/log"));
    log4cplus::tstring filename = logpath.string<tstring>();

    log4cplus::SharedAppenderPtr appender(new log4cplus::RollingFileAppender(filename, MAXFILESIZE, MAXBACKUPINDEX, true, true));

    appender->setName(name);
    std::auto_ptr<log4cplus::Layout> newLayout(m_factory->createObject(*m_layoutProperties));
    appender->setLayout(newLayout);

    logger.addAppender(appender);
}
else
{   
    logger = log4cplus::Logger::getInstance(name);
}

logger.callAppenders(event2);  //中断在这啦 Interrupt Here 
seafeawea
  • 11
  • 2
  • http://www.joelonsoftware.com/articles/Unicode.html – Hans Passant Nov 02 '16 at 10:58
  • I think this is related to http://stackoverflow.com/q/33254089/341065. There is also a workaround in the question. – wilx Nov 02 '16 at 15:32
  • This happens only when I t write Chinese characters to log. The program keep writing Chinese characters to log. This usually happens in few minutes later (It works well in the beginning of program). – seafeawea Nov 04 '16 at 04:59

0 Answers0