我正在尝试在调试模式下运行程序并使用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