当前位置: 首页>>代码示例>>C++>>正文


C++ LOG4CPLUS_WARN函数代码示例

本文整理汇总了C++中LOG4CPLUS_WARN函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG4CPLUS_WARN函数的具体用法?C++ LOG4CPLUS_WARN怎么用?C++ LOG4CPLUS_WARN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOG4CPLUS_WARN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: switch

int CSignalSemaphoreInterproc::tryWait (void)
{
   if (sem_trywait(mpSem) == 0)
   {
      return 0;
   }
   else
   {
      int saved_errno = errno;
      switch (saved_errno)
      {
      case EAGAIN:
            break;
      case EDEADLK:
      case EINTR:
      case EINVAL:
         {
            LOG4CPLUS_WARN(logger, "tryWait(): sem_trywait failed: " + convertIntegerToString(saved_errno)
                                 + " - " + std::string(strerror(saved_errno)));
            break;
         }
         /* // all other cases must wait again */
      default :
         {
             LOG4CPLUS_WARN(logger, "tryWait(): sem_trywait failed: " + convertIntegerToString(saved_errno)
                                  + " - " + std::string(strerror(saved_errno)));
             break;
         }
      }
      return -1;
   }
}
开发者ID:saphina,项目名称:iviLink,代码行数:32,代码来源:CSignalSemaphoreInterproc.cpp

示例2: dataUploadThread

void dataUploadThread(void* arg)
{
  
  /* In windows, this will init the winsock stuff */ 
  curl_global_init(CURL_GLOBAL_ALL);
  
  
  UploadThreadData* udata = (UploadThreadData*) arg;
  

  
  
  while(daemon_active)
  {
    try
    {
      Beanstalk::Client client(BEANSTALK_QUEUE_HOST, BEANSTALK_PORT);
      
      client.watch(BEANSTALK_TUBE_NAME);
    
      while (daemon_active)
      {
	Beanstalk::Job job;
	
	client.reserve(job);
	
	if (job.id() > 0)
	{
	  //LOG4CPLUS_DEBUG(logger, job.body() );
	  if (uploadPost(udata->upload_url, job.body()))
	  {
	    client.del(job.id());
	    LOG4CPLUS_INFO(logger, "Job: " << job.id() << " successfully uploaded" );
	    // Wait 10ms
	    usleep(10000);
	  }
	  else
	  {
	    client.release(job);
	    LOG4CPLUS_WARN(logger, "Job: " << job.id() << " failed to upload.  Will retry." );
	    // Wait 2 seconds
	    usleep(2000000);
	  }
	}
	
      }
      
    }
    catch (const std::runtime_error& error)
    {
      LOG4CPLUS_WARN(logger, "Error connecting to Beanstalk.  Will retry." );
    }
    // wait 5 seconds
    usleep(5000000);
  }
  
  curl_global_cleanup();
}
开发者ID:Simage,项目名称:openalpr,代码行数:58,代码来源:daemon.cpp

示例3: LOG4CPLUS_TRACE

  const PlacementTemplate*
  PlacementContentHandler::match_placement_template(
      uint16_t id,
      const IETemplate* wire_template) const {
    LOG4CPLUS_TRACE(logger, "ENTER match_placement_template");

    /* This strategy: return first match. Other strategies are also
     * possible, such as "return match with most IEs". */
    std::map<const IETemplate*, const PlacementTemplate*>::const_iterator m;

    if (use_matched_template_cache)
      m = matched_templates.find(wire_template);
    else
      m = matched_templates.end();

    if (m == matched_templates.end()) {
      for (auto i = placement_templates.begin();
           i != placement_templates.end();
           ++i) {
        std::set<const InfoElement*>* unmatched 
          = new std::set<const InfoElement*>();

        unsigned int n_matches = (*i)->is_match(wire_template, unmatched);
        LOG4CPLUS_TRACE(logger, "n_matches=" << n_matches 
                        << ",unmatched->size()=" << unmatched->size()
                        << ",wire_template->size()="
                        << wire_template->size());

        if (n_matches > 0) {
          assert(n_matches <= wire_template->size());

          if (n_matches < wire_template->size()) {
            /* We're losing columns, so let's warn about them. */
            assert(unmatched->size() == wire_template->size() - n_matches);

            if (incomplete_template_ids.count(make_template_key(id)) == 0) {
              LOG4CPLUS_WARN(logger, "  Template match on wire template "
                             "for domain " << observation_domain
                             << " and template ID " << id 
                             << " successful, but incomplete");

              LOG4CPLUS_WARN(logger, "  List of unmatched IEs follows:");
              for (auto k = unmatched->begin(); k != unmatched->end(); ++k)
                LOG4CPLUS_WARN(logger, "    " << (*k)->toIESpec());
              incomplete_template_ids.insert(make_template_key(id));
            }
          }
          delete unmatched;

          matched_templates[wire_template] = *i;
          return *i;
        }
      }
      return 0;
    } else
      return m->second;
  }
开发者ID:britram,项目名称:libfc,代码行数:57,代码来源:PlacementContentHandler.cpp

示例4: 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
		}
	}
开发者ID:neilgroves,项目名称:MlbDev,代码行数:56,代码来源:LogHandlerLog4CPlus.hpp

示例5: switch

void Database::addToBatch(db_data data) {
	int response = 0;

	switch (data.status) {
	case OK:
		sqlite3_bind_text(addOkStmt, 1, data.filePath.c_str(), data.filePath.string().size(), SQLITE_STATIC );
		sqlite3_bind_int64(addOkStmt, 2, data.pHash);
		sqlite3_bind_text(addOkStmt, 3, data.sha256.c_str(), data.sha256.size(), SQLITE_STATIC);

		response = sqlite3_step(addOkStmt);

		if (response != SQLITE_DONE) {
			LOG4CPLUS_WARN(logger, "Failed to add " << data.filePath << " / " << data.pHash);
			recordsWritten--;
		}
		sqlite3_reset(addOkStmt);
		break;

	case SHA:
		updateSHA256(data.filePath.string(), data.sha256);
		break;

	case INVALID:
		sqlite3_bind_text(addInvalidStmt, 1, data.filePath.c_str(), data.filePath.string().size(), SQLITE_STATIC );
		response = sqlite3_step(addInvalidStmt);

		if (response != SQLITE_DONE) {
			LOG4CPLUS_WARN(logger, "Failed to add " << data.filePath);
			recordsWritten--;
		}

		sqlite3_reset(addInvalidStmt);
		break;

	case FILTER:
		sqlite3_bind_int64(addFilterStmt, 1, data.pHash);
		sqlite3_bind_text(addFilterStmt, 2, data.reason.c_str(), data.reason.size(), SQLITE_STATIC);
		response = sqlite3_step(addFilterStmt);

		if (response != SQLITE_DONE) {
			LOG4CPLUS_WARN(logger, "Failed to add filter for " << data.pHash << " " << data.reason);
		}

		sqlite3_reset(addFilterStmt);
		break;

	default:
		LOG4CPLUS_ERROR(logger, "Unhandled state encountered");
		throw "Unhandled state encountered";
		break;
	}
}
开发者ID:yanguanglan,项目名称:imageHasher,代码行数:52,代码来源:Database.cpp

示例6: LOG4CPLUS_TRACE_METHOD

bool ProfileDatabase::loadParsedDatabase(const pugi::xml_document &doc)
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
    if (EDB_NORMAL_OK != mDbState)
    {
        LOG4CPLUS_ERROR(msLogger, "parsing state error");
        return false;
    }
    pugi::xml_node profs = doc.child("profiles");

    for (pugi::xml_node_iterator it = profs.begin(); it != profs.end(); ++it)
    {
        LOG4CPLUS_INFO(msLogger, "Profile adding");
        Profile::Uid profileUid = Profile::Uid(it->child_value("uid"));
        Profile::ApiUid apiUid = Profile::ApiUid(it->child_value("api-uid"));
        std::string name = it->child_value("name");
        Profile::Uid complement = Profile::Uid(it->child_value("complement"));
        if ("" == profileUid.value() || "" == apiUid.value() || "" == complement.value() || "" == name)
        {
            LOG4CPLUS_WARN(msLogger, "Profile adding error\nProfile UID: " + profileUid.value() +
                    ", API UID: " + apiUid.value() + ", Complement UID: " + complement.value() +
                    ", name: " + name);
            continue;
        }
        ProfileInfo profile(profileUid, apiUid, complement, name);

        pugi::xml_node libs = it->child("libs");
        for (pugi::xml_node_iterator sit = libs.begin(); sit != libs.end(); ++sit)
        {
            std::string pathToLib = mRootFolderPath + (std::string)sit->attribute("path").value();
            UInt32 version = atoi(sit->attribute("version").value());
            std::string platform = sit->attribute("platform").value();
            profile.addLib(ProfileLibInfo(version, pathToLib, platform));
        }

        ProfileInfoMap::iterator mit = mProfiles.find(profile.uid());
        if (mProfiles.end() == mit)
        {
            mProfiles.insert(std::make_pair(profile.uid(), profile));
            LOG4CPLUS_INFO(msLogger, "Added profile into profiles map, profile UID: " + profile.uid().value());
        }
        else
        {
            LOG4CPLUS_WARN(msLogger, "Error: UID repetition: " + profile.uid().value());
        }
    }
    return true;
}
开发者ID:Luxoft,项目名称:iviLink,代码行数:48,代码来源:ProfileDatabase.cpp

示例7: LOG4CPLUS_TRACE_METHOD

void SystemControllerProxy::OnAsyncRequest(iviLink::Ipc::MsgID id, UInt8 const* pPayload, UInt32 payloadSize,
            iviLink::Ipc::DirectionID)
{
   LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__);
   SystemControllerToWatchdog message;
   memcpy(&message, pPayload, payloadSize);
   switch (message)
   {
      case SC_WD_LAUNCHED_PHYSICAL_LAYER:
        onPhysicalLayerStarted();
        break;
      case SC_WD_LAUNCHED_CHANNEL_LAYER:
        onChannelLayerStarted();
        break;
      case SC_WD_LAUNCHED_PROFILE_LAYER:
        onProfileLayerStarted();
        break;
      case SC_WD_LAUNCHED_APPLICATION_LAYER:
        onApplicationLayerStarted();
        break;
      case SC_WD_LAUNCHED_AUTHENTICATON:
        onAuthenticationStarted();
        break;
      case SC_WD_STOPPED_AUTHENTICATION:
        onAuthenticationStopped();
        break;
      default:
        LOG4CPLUS_WARN(mLogger, "Unknown input");
        assert(false);
   }
}
开发者ID:Luxoft,项目名称:iviLink,代码行数:31,代码来源:SystemControllerProxy.cpp

示例8: LOG4CPLUS_TRACE_METHOD

      BaseError CServiceManager::initPmal()
      {
         LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);

         AppMan::CAppManConnectController * pAppmanCC
                       = AppMan::CAppManConnectController::instance(mAppInfo);

         PMAL::CPMALError err = PMAL::CPMALComponentMgr::create(this, NULL);
         if (!err.isNoError())
         {
            return err;
         }
         PMAL::CPMALComponentMgr* pPmalMgr = PMAL::CPMALComponentMgr::getInstance();

         if (!pAppmanCC)
         {
            return BaseError(1, gModuleName, BaseError::IVILINK_FATAL, "unable to get app man connect controller");
         }

         iviLink::AppMan::IAppManHandler* pHandler = pPmalMgr->getAppManHandler();
         if (!pHandler)
         {
            LOG4CPLUS_WARN(msLogger, "unable to get app man handler");
            return BaseError(1, gModuleName, BaseError::IVILINK_FATAL, "unable to get app man handler");
         }

         pAppmanCC->init(pHandler);

         return BaseError::NoError();
      }
开发者ID:Luxoft,项目名称:iviLink,代码行数:30,代码来源:CServiceManager.cpp

示例9: 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);
	}
}
开发者ID:adidos,项目名称:poker,代码行数:65,代码来源:resp_processor.cpp

示例10: LOG4CPLUS_TRACE_METHOD

    void AppStatusAggregator::OnAsyncRequest(iviLink::Ipc::MsgID id, UInt8 const* pPayload, UInt32 payloadSize,
                iviLink::Ipc::DirectionID dirId) 
    {
        LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__);
        LOG4CPLUS_INFO(mLogger, "payloadSize: " + convertIntegerToString(payloadSize));

        UInt32 pos = 0;
        UInt8 type = 0;
        memcpy(&type,pPayload+pos,sizeof(type));
        pos += sizeof(type);

        char chmsg[payloadSize];
        memcpy(chmsg,pPayload + pos,payloadSize);
        std::string msg(chmsg);

        switch(type)
        {
            case TRACK_FROM_MEDIA:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from media: " + msg);
                pushMsgToQueue(mLauncherID,MEDIA,msg);
                break;
            }
            case INIT_FROM_LAUNCHER:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from launcher: " + msg);
                mLauncherID = dirId;
                break;
            }
            case INIT_FROM_MEDIA:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from media: " + msg);
                mMediaID = dirId;
                break;
            }
            case INIT_FROM_CLIMATE:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from climate: " + msg);
                mClimateID = dirId;
                break;
            }
            case INFO_FROM_CLIMATE:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from climate: " + msg);
                pushMsgToQueue(mLauncherID,CLIMATE,msg);
                break;
            }
            case SHOW_FROM_LAUNCHER:
            {
                LOG4CPLUS_INFO(mLogger, "received msg from launcher: " + msg);
                pushMsgToQueue(mMediaID,LAUNCHER,msg);
                break;
            }
            default:
            {
                LOG4CPLUS_WARN(mLogger, "AppStatusAggregator Unknown request");
                break;
            }
        }
    }
开发者ID:Luxoft,项目名称:iviLink,代码行数:60,代码来源:AppStatusAggregator.cpp

示例11: lock

void Database::prunePath(std::list<fs::path> filePaths) {
	boost::mutex::scoped_lock lock(dbMutex);

	bool allOk = true;

	startTransaction();

	for(std::list<fs::path>::iterator ite = filePaths.begin(); ite != filePaths.end(); ++ite){
		const char* path = ite->c_str();
		int pathSize = ite->string().size();
		int response = 0;

		sqlite3_bind_text(pruneDeleteImageStmt, 1, path, pathSize, SQLITE_TRANSIENT);
		sqlite3_bind_text(pruneDeleteBadFileStmt, 1, path, pathSize, SQLITE_TRANSIENT);

		response = sqlite3_step(pruneDeleteImageStmt);
		if(SQLITE_DONE != response) {allOk = false;}
		response = sqlite3_step(pruneDeleteBadFileStmt);
		if(SQLITE_DONE != response) {allOk = false;}

		sqlite3_reset(pruneDeleteImageStmt);
		sqlite3_reset(pruneDeleteBadFileStmt);
	}

	commitTransaction();

	if (!allOk) {
		LOG4CPLUS_WARN(logger, "Failed to delete some file paths");
	}
}
开发者ID:yanguanglan,项目名称:imageHasher,代码行数:30,代码来源:Database.cpp

示例12: LOG4CPLUS_TRACE_METHOD

void CMediaControlServerProfile::onDisable() {
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    CError err = iviLink::Channel::deallocateChannel(mChannelID);
    if (!err.isNoError()) {
        LOG4CPLUS_WARN(msLogger, "Unable to deallocate channel: " + static_cast<std::string> (err));
    }
}
开发者ID:babenkoav78,项目名称:iviLink,代码行数:7,代码来源:CMediaControlServerProfile.cpp

示例13: fprintf

void Logging::Warn(const string& msg) {
    if("" == logger_name_) {
        fprintf(stderr, "has not set logger\n");
        return;
    }
    LOG4CPLUS_WARN(logger_, msg);
}
开发者ID:binggozju,项目名称:webhttpd,代码行数:7,代码来源:logging.cpp

示例14: InitializeLogging

void InitializeLogging() {
   if (Logging_initialized) {
      return;
   }
   Logging_initialized = true;

   log4cplus::initialize();
   log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("logging.init"));
   char *prop_file = getenv("LOG4CPLUS_PROPERTIES");
   if (prop_file == NULL) {
      // fall back to log4cplus.properties
      prop_file = (char *) "log4cplus.properties";
   }
   if (access(prop_file, F_OK) == -1) {
      log4cplus::BasicConfigurator config;
      config.configure();
      LOG4CPLUS_WARN(logger, "Cannot access LOG4CPLUS_PROPERTIES "
            << prop_file << ", using BasicConfigurator.");
   } else {
      log4cplus::PropertyConfigurator config(prop_file);
      config.configure();
      LOG4CPLUS_INFO(logger, "LOG4CPLUS_PROPERTIES file is " <<
                                                             LOG4CPLUS_TEXT(prop_file));
   }

   // Example usage of the debug logger
//	LOG4CPLUS_DEBUG(logger, "Pi is " << (4 * atan(1)) << " approximately");
}
开发者ID:mitre,项目名称:FMACM,代码行数:28,代码来源:Logging.cpp

示例15: 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;
}
开发者ID:Simage,项目名称:openalpr,代码行数:25,代码来源:daemon.cpp


注:本文中的LOG4CPLUS_WARN函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。