1

我正在尝试在调试模式下运行程序并使用 log4cplus 将一些消息打印到文件中。它在第一秒内运行良好。却突然打断

_ASSERTE(isleadbyte(_dbcsBuffer(fh)));

我不知道发生了什么。为什么?

这是部分代码

// 写日志 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 
4

0 回答 0