本文整理汇总了C++中LOG4CPLUS_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG4CPLUS_ERROR函数的具体用法?C++ LOG4CPLUS_ERROR怎么用?C++ LOG4CPLUS_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG4CPLUS_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG4CPLUS_TRACE_METHOD
bool CServiceManager::incomingLoad(const Service::Uid & service)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
mSystemServicesMutex.lock();
tServiceSet::const_iterator it = mSystemServices.find(service);
if (mSystemServices.end() == it)
{
LOG4CPLUS_ERROR( msLogger, "incomingLoad(" + service.value() + "): failed to find service");
mSystemServicesMutex.unlock();
return false;
}
mSystemServicesMutex.unlock();
if(isServiceAlreadyLoaded(service))
{
return true;
}
CService * pService = new CService(mXmlPath, mAppInfo, service);
mCallbacksMutex.lock();
if (!pService->incomingLoad(mCallbacks))
{
mCallbacksMutex.unlock();
delete pService;
LOG4CPLUS_ERROR( msLogger, "pService->incomingLoad(" + service.value() + ") return false");
return false;
}
mCallbacksMutex.unlock();
mActiveServicesMutex.lock();
mActiveServices[service] = pService;
mActiveServicesMutex.unlock();
return true;
}
示例2: main
int main(int, char **)
{
Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("utils.Test"));
PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));
LOG4CPLUS_ERROR(logger, "Test start");
CTimeoutManager * pInstance = CTimeoutManager::getInstance();
pInstance->addSubscriber(new CSubscriber("\n### three ###\n", 3), 500);
pInstance->addSubscriber(new CSubscriber("\n### one ###\n", 1), 450);
CSubscriber * pSub = new CSubscriber("\n### empty ###\n", -10);
pInstance->addSubscriber(pSub, 500);
pInstance->addSubscriber(new CSubscriber("\n### four ###\n", 4), 900);
pInstance->removeSubscriber(pSub);
pInstance->addSubscriber(new CSubscriber("\n### two ###\n", 2), 450);
gSem.waitTimeout(2000);
if (5 == gCount)
{
LOG4CPLUS_ERROR(logger, "Test passed!\n OK OK OK OK OK OK OK OK OK OK OK OK");
}
else
{
LOG4CPLUS_ERROR(logger, "Test failed, gCount = " + convertIntegerToString(gCount));
}
CTimeoutManager::deleteInstance();
CTimeoutManager::getInstance(); // check quick deleteing of CTimeoutManager instance
CTimeoutManager::deleteInstance();
}
示例3: LOG4CPLUS_TRACE_METHOD
bool PmpIpcProtocol::getProfileLibPathResponse(const std::string & path,
iviLink::Ipc::DirectionID const& dirId)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
CBuffer writeBuf = mWriteBufMgr.getBuffer();
ProfileManager::Ipc::PmMessage* req = reinterpret_cast<ProfileManager::Ipc::PmMessage*>(writeBuf.get());
req->header.type = ProfileManager::Ipc::PMP_PMAL_GET_PROFILE_LIB_PATH;
iviLink::Ipc::Helpers::CBufferWriter writer(req->data, writeBuf.getSize() - sizeof(req->header));
BaseError err = writer.write(path);
if (!err.isNoError())
{
LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
return false;
}
req->header.size = writer.getUsedSize();
iviLink::Ipc::MsgID id = mMsgIdGen.getNext();
UInt32 const reqSize = sizeof(ProfileManager::Ipc::PmMessage) + req->header.size;
err = mIpc->asyncRequest(id, writeBuf.get(), reqSize, &dirId);
if (!err.isNoError())
{
LOG4CPLUS_ERROR(msLogger, static_cast<std::string>(err));
return false;
}
return true;
}
示例4: assert
/**
* brief:
*
* @returns
*/
void RespProcessor::doIt()
{
char buffer[16*1024] = {'\0'};
ResponseManager* pRespMgr = ResponseManager::getInstance();
assert(NULL != pRespMgr);
while(true)
{
CmdTask resp;
bool ret = pRespMgr->getRespTask(resp);
if(!ret)
{
LOG4CPLUS_WARN(CLogger::logger, "response array is empty.");
continue;
}
SessionBase* pSession = _sess_mgr_prt->getSession(resp.seqno);
if(NULL == pSession)
{
LOG4CPLUS_ERROR(CLogger::logger, "can't find the session by " << resp.seqno);
delete resp.pCmd;
resp.pCmd = NULL;
continue;
}
int64_t uid = resp.pCmd->get_userid();
string name = resp.pCmd->get_cmd_name();
memset(buffer, '\0', 16 * 1024);
int length = resp.pCmd->header_length() + resp.pCmd->body_length();
ret = resp.pCmd->encode((byte*)buffer, length);
resp.releaseCmd();
if(!ret)
{
LOG4CPLUS_ERROR(CLogger::logger, "command encode failed for " << name);
continue;
}
pSession->write2Send(string(buffer, length));
int iret = pSession->sendBuffer();
uint64_t data = U64(resp.seqno, pSession->getFd());
if(SOCKET_EAGAIN == iret) //socket»º³åÇøдÂú
{
_epoll_svr_ptr->notify(pSession->getFd(), data, EVENT_WRITE);
}
else if(SOCKET_ERR == iret) //socket ³ö´í
{
_epoll_svr_ptr->notify(pSession->getFd(), data, EVENT_ERROR);
_sess_mgr_prt->freeSession(pSession);
_client_mgr_prt->freeClient(uid, resp.seqno);
}
LOG4CPLUS_INFO(CDebugLogger::logger, "TimeTace: request[" << resp.idx << "] to response["
<< name << "] spend time " << current_time_usec() - resp.timestamp);
Index::free(resp.idx);
}
}
示例5: CMutex
CServerControl::CServerControl(IMediaControlServerProfile_API::Callbacks* callbacks)
: //mpMutex(new CMutex()),
mVTranscode(VCODE)
, mATranscode(ACODE)
, mServerPath(MediaServerName)
, mFd(0)
, mStop ("stop;")
, mResume("resume;")
, mPause("pause;")
, mAudio("audio")
, mVideo("video")
, mPlay ("play;")
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
assert(callbacks);
pipe (fds);
char path[MAXPATHLEN];
getcwd(path, MAXPATHLEN);
LOG4CPLUS_INFO(msLogger, "!!!!!!!!!!!!!!!!!!!!!!!!!!");
LOG4CPLUS_INFO(msLogger, "path: " + std::string(path));
mServerPath = std::string(path) + "/" + mServerPath;
LOG4CPLUS_INFO(msLogger, "full path: "+ mServerPath);
#ifndef ANDROID
pid_t pid = fork();
switch (pid) {
case -1:
{
LOG4CPLUS_ERROR(msLogger, "after fork pid = -1");
return;
break;
}
case 0:
{
LOG4CPLUS_INFO(msLogger, "child");
close(fds[1]);
char fd_str[15];
sprintf(fd_str, "%i", fds[0]);
if (execl(mServerPath.c_str(), mServerPath.c_str(), fd_str, NULL)) {
LOG4CPLUS_ERROR(msLogger, "execl(server) failed");
killProcess(1);
}
killProcess(1);
}
default:
{
LOG4CPLUS_INFO(msLogger, "parent");
close(fds[0]);
file = fdopen(fds[1], "w");
break;
}
}
#else
callbacks->startVlcServer(fds[0], true);
file = fdopen(fds[1], "w");
#endif //ANDROID
}
示例6: ForwardString
static void ForwardString(log4cplus::Logger &app_instance,
LogLevel log_level, const char *out_string) {
if (out_string == NULL)
out_string = "";
#ifdef _Windows
# pragma warning(push)
# pragma warning(disable:4127)
#endif // #ifdef _Windows
switch (log_level) {
case LogLevel_Literal :
LOG4CPLUS_TRACE(app_instance, out_string);
break;
case LogLevel_Spam :
LOG4CPLUS_TRACE(app_instance, out_string);
break;
case LogLevel_Minutiae :
LOG4CPLUS_TRACE(app_instance, out_string);
break;
case LogLevel_Debug :
LOG4CPLUS_DEBUG(app_instance, out_string);
break;
case LogLevel_Detail :
LOG4CPLUS_DEBUG(app_instance, out_string);
break;
case LogLevel_Info :
LOG4CPLUS_INFO(app_instance, out_string);
break;
case LogLevel_Notice :
LOG4CPLUS_WARN(app_instance, out_string);
break;
case LogLevel_Warning :
LOG4CPLUS_WARN(app_instance, out_string);
break;
case LogLevel_Error :
LOG4CPLUS_ERROR(app_instance, out_string);
break;
case LogLevel_Critical :
LOG4CPLUS_ERROR(app_instance, out_string);
break;
case LogLevel_Alert :
LOG4CPLUS_ERROR(app_instance, out_string);
break;
case LogLevel_Emergency :
LOG4CPLUS_ERROR(app_instance, out_string);
break;
case LogLevel_Fatal :
LOG4CPLUS_FATAL(app_instance, out_string);
break;
default :
LOG4CPLUS_ERROR(app_instance, out_string);
break;
#ifdef _Windows
# pragma warning(pop)
#endif // #ifdef _Windows
}
}
示例7: getInstance
void RTSPMJPEGClient::threadLoop(RTSPMJPEGClientParameters *parameters)
{
int clientId = parameters->clientId;
RTSPMJPEGClient *instance = getInstance();
RTSPMJPEGClientStruct *pClient = instance->clients[clientId];
if (pClient == NULL)
{
pClient = new RTSPMJPEGClientStruct;
pClient->clientId = clientId;
pClient->state = RTSPMJPEGCLIENT_STATE_CLEANED;
pClient->isWaiting = false;
pClient->newFramesNum = 0;
pClient->next = 0;
for (int i = 0; i < RTSPMJPEGCLIENT_FRAME_QUEUE_LEN; i++)
{
pClient->frameQueue[i] = (uint8_t * ) av_malloc(RTSPMJPEGCLIENT_FRAME_BUFFER_SIZE);
pClient->frameSizes[i] = 0;
}
instance->clients[clientId] = pClient;
LOG4CPLUS_DEBUG(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] allocated space for a new client...");
}
LOG4CPLUS_TRACE(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] threadLoop()...");
pClient->address = ((RTSPMJPEGClientParameters * ) parameters)->address;
delete parameters;
if (instance->_init(pClient) < 0)
{
instance->_clean(pClient, RTSPMJPEGCLIENT_STATE_ERROR);
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_ERROR_LOGGER)), "[CLIENT " << pClient->clientId << "] init failed!");
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] init failed!");
return;
}
pClient->state = RTSPMJPEGCLIENT_STATE_LOOPING;
while (pClient->state == RTSPMJPEGCLIENT_STATE_LOOPING && instance->_readFrame(pClient) == 0)
LOG4CPLUS_DEBUG(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] while()...");
// set CLEANED only if it was correctly stopped. ERROR otherwise. Don't set
// any state greater then CLEANED because they're all states indicating an
// action being taken
instance->_clean(pClient, pClient->state == RTSPMJPEGCLIENT_STATE_STOPPING ? RTSPMJPEGCLIENT_STATE_CLEANED : RTSPMJPEGCLIENT_STATE_ERROR);
}
示例8: LOG4CPLUS_ERROR
void RTSPMJPEGClient::_logAVError(RTSPMJPEGClientStruct *pClient, int error)
{
if (av_strerror(error, pClient->errbuf, RTSPMJPEGCLIENT_ERRBUF_SIZE) == 0)
{
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_ERROR_LOGGER)), "[CLIENT " << pClient->clientId << "] LibAV error: " << pClient->errbuf);
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] LibAV error: " << pClient->errbuf);
}
else
{
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_ERROR_LOGGER)), "[CLIENT " << pClient->clientId << "] LibAV error: Unknown error...");
LOG4CPLUS_ERROR(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] LibAV error: Unknown error...");
}
}
示例9: GetValue
bool TestManager::RunUpdateConsumption(TestParameters* testParameters) const
{
Logger logger = Logger::getInstance(TESTER_LOGGER_NAME);
char* pcEnd;
string sCartridgeNum = GetValue("CartridgeNum", testParameters);
unsigned char ucCartridgeNum = (unsigned char)strtol(sCartridgeNum.c_str(), &pcEnd, 10);
if (*pcEnd != 0)
{
LOG4CPLUS_ERROR(logger, "Invalid cartridge num (" << sCartridgeNum << ").");
return false;
}
string sConsumption = GetValue("Consumption", testParameters);
string sMaxConsumption;
size_t idx = sConsumption.find("..");
if (idx != string::npos)
{
sMaxConsumption = sConsumption.substr(idx + 2, sConsumption.length() - (idx + 2));
sConsumption = sConsumption.substr(0, idx);
}
else
{
sMaxConsumption = sConsumption;
}
unsigned int uiConsumption = (unsigned int)strtol(sConsumption.c_str(), &pcEnd, 10);
if (*pcEnd != 0)
{
LOG4CPLUS_ERROR(logger, "Invalid consumption (" << sConsumption << ").");
return false;
}
unsigned int uiMaxConsumption = (unsigned int)strtol(sMaxConsumption.c_str(), &pcEnd, 10);
if (*pcEnd != 0)
{
LOG4CPLUS_ERROR(logger, "Invalid consumption (" << sMaxConsumption << ").");
return false;
}
uiConsumption += (rand() % (uiMaxConsumption - uiConsumption + 1));
unsigned int originalVolume = m_volumes[ucCartridgeNum];
testParameters->Result = materialMonitor->UpdateConsumption(ucCartridgeNum, uiConsumption, &m_volumes[ucCartridgeNum]);
if (testParameters->Result != IDTLIB_SUCCESS)
{
m_volumes[ucCartridgeNum] = originalVolume;
}
return testParameters->Result == testParameters->ExpectedResult;
}
示例10: LOG4CPLUS_TRACE
ErrorCode DiskWriteTask::ExecuteDiskWrite(boost::shared_ptr<SmallFileLocalDisk> disk)
{
boost::filesystem::path resource_folder_path = disk->GetResourceFolderPath(resource_identifier_);
LOG4CPLUS_TRACE(Loggers::LocalDisk(), "DiskWriteTask::Execute(): Writing "<<resource_identifier_.GetResourceName()<<"("<<blocks_.size()<<" blocks) into disk " << disk->GetDiskPath());
if (boost::filesystem::exists(resource_folder_path))
{
LOG4CPLUS_TRACE(Loggers::LocalDisk(), "DiskWriteTask::Execute(): resource directory "<<resource_folder_path<<" already exists.");
}
else if (!boost::filesystem::create_directories(resource_folder_path))
{
LOG4CPLUS_ERROR(Loggers::LocalDisk(), "DiskWriteTask::Execute(): Failed to create directory "<<resource_folder_path);
return ErrorCodes::DiskWriteFailure;
}
size_t resource_size = 0;
assert(blocks_.size() > 0);
if (blocks_.size() == 0)
{
LOG4CPLUS_WARN(Loggers::LocalDisk(), "DiskWriteTask::Execute(): An attempt to write empty blocks to "<<resource_folder_path<<" is rejected.");
return ErrorCodes::UnknownError;
}
for(std::map<size_t, boost::shared_ptr<BlockData> >::const_iterator iter = blocks_.begin();
iter != blocks_.end();
++iter)
{
size_t block_index = iter->first;
boost::shared_ptr<BlockData> block_data = iter->second;
if (block_data)
{
boost::filesystem::path block_file_path = disk->GetResourceBlockFilePath(resource_identifier_, block_index);
LOG4CPLUS_TRACE(Loggers::LocalDisk(), "DiskWriteTask::Execute(): Writing block file "<<block_file_path);
if (block_data->WriteFile(block_file_path))
{
resource_size += block_data->Size();
}
else
{
LOG4CPLUS_ERROR(Loggers::LocalDisk(), "DiskWriteTask::Execute(): Failed to write "<<block_file_path);
}
}
}
disk->UpdateResource(resource_identifier_);
return ErrorCodes::Success;
}
示例11: open
BlockData::BlockData(const boost::filesystem::path& block_file_path)
{
block_data_bytes_ = 0;
bytes_ = 0;
int file_descriptor = open(block_file_path.file_string().c_str(), O_RDONLY | O_DIRECT);
if (file_descriptor < 0)
{
LOG4CPLUS_ERROR(Loggers::Service(), "Failed to open file "<<block_file_path<<" to read.");
return;
}
block_data_bytes_ = reinterpret_cast<char*>(BlockDataAllocator::Instance().Allocate());
if (!block_data_bytes_)
{
LOG4CPLUS_ERROR(Loggers::Service(), "Failed to allocate aligned memory buffer.");
close(file_descriptor);
return;
}
//read up to MaxBlockSize bytes to the buffer
size_t offset(0);
int bytes_read(0);
int bytes_left(BlockData::MaxBlockSize);
do
{
bytes_read = pread(file_descriptor, block_data_bytes_ + offset, bytes_left, offset);
if (bytes_read > 0)
{
bytes_left -= bytes_read;
offset += bytes_read;
}
}
while (bytes_left > 0 && bytes_read > 0);
if (bytes_read < 0)
{
LOG4CPLUS_ERROR(Loggers::Service(), "An error occurred while reading file file "<<block_file_path);
close(file_descriptor);
BlockDataAllocator::Instance().Free(block_data_bytes_);
block_data_bytes_ = 0;
return;
}
close(file_descriptor);
bytes_ = offset;
}
示例12: LOG4CPLUS_ERROR
void ChannelServer::send_data_stress_test_core(bool confirm)
{
iviLink::Error error = iviLink::Channel::allocateChannel(gSendData, this, cid);
if (!error.isNoError() || cid == 0)
{
LOG4CPLUS_ERROR(logger, "send_data_stress_test allocation failed");
return;
}
else
{
LOG4CPLUS_ERROR(logger, "send_data_stress_test allocation successful, signaling to client");
}
mCliSyncSem.signal();
mSrvSyncSem.wait();
}
示例13: writeToQueue
bool writeToQueue(std::string jsonResult)
{
try
{
Beanstalk::Client client(BEANSTALK_QUEUE_HOST, BEANSTALK_PORT);
client.use(BEANSTALK_TUBE_NAME);
int id = client.put(jsonResult);
if (id <= 0)
{
LOG4CPLUS_ERROR(logger, "Failed to write data to queue");
return false;
}
LOG4CPLUS_DEBUG(logger, "put job id: " << id );
}
catch (const std::runtime_error& error)
{
LOG4CPLUS_WARN(logger, "Error connecting to Beanstalk. Result has not been saved.");
return false;
}
return true;
}
示例14: LOG4CPLUS_TRACE_METHOD
void NaviPlayer::onInitDone(iviLink::ELaunchInfo launcher)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
if (iviLink::LAUNCHED_BY_USER == launcher)
{
LOG4CPLUS_INFO(msLogger, "started by user");
LOG4CPLUS_INFO(msLogger, "Registering profile callbacks");
registerProfileCallbacks(iviLink::Profile::ApiUid("NaviReceiverProfile_PAPI_UID"),this);
mpParent->setText("Loading...");
iviLink::Error loadError = loadService(iviLink::Service::Uid(SERVICE));
if (loadError.isNoError())
{
LOG4CPLUS_INFO(msLogger, "service started successfully!");
mpParent->setText("Click to exit");
mpParent->setEnabled(true);
}
else
{
LOG4CPLUS_ERROR(msLogger, std::string("service NOT started") + loadError.toString());
kill(getpid(), SIGKILL);
}
}
else
{
LOG4CPLUS_INFO(msLogger, "started by iviLink");
}
}
示例15: pctx
void config_handler::handle_request(const request& req, reply& rep)
{
timer t;
mem_counter mc;
boost::scoped_ptr<argos::common::ExecutionContext> pctx(the_index_->create_context());
argos::common::ExecutionContext &ctx=*(pctx.get());
try {
rep.content=the_index_->get_field_config()->serialize();
rep.status = reply::ok;
rep.headers.resize(2);
rep.headers[0].name = "Content-Length";
rep.headers[0].value = boost::lexical_cast<std::string>(rep.content.size());
rep.headers[1].name = "Content-Type";
rep.headers[1].value = "application/xml";
}
catch(...) {
rep=reply::stock_reply(reply::internal_server_error);
LOG4CPLUS_ERROR(err, "CLIENT:" << req.peer << ", CODE:" << rep.status << " - " << req.uri);
}
LOG4CPLUS_INFO(acc, "CLIENT:" << req.peer << ", CODE:" << rep.status << ", TIME:" << t*1000 << "ms, MEM:" << mc << ", CL:" << rep.content.size() << ", QID:[], URL:" << req.uri);
if (ctx.temp_pool->get_used_size()>3*1024*1024) {
ctx.temp_pool->reset();
}
}