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


C++ LOG4CXX_ERROR函数代码示例

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


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

示例1: LOG4CXX_ERROR

Status4ZxClient ZxClient::getStatus(){
    Status4ZxClient value = Close;
    if (pthread_mutex_lock(&m_statusMutex)) {
        LoggerPtr rootLogger = Logger::getRootLogger();  
        LOG4CXX_ERROR(rootLogger, "pthread_mutex_lock(&m_statusMutex) failed!");
        return value;
    }
    value =  m_status;
    pthread_mutex_unlock(&m_statusMutex);
    return value;
}
开发者ID:StrayBirdsGOGOGO,项目名称:DevProj,代码行数:11,代码来源:zxclient.cpp

示例2: LOG4CXX_ERROR

bool MemCacheServerHandler::GetPlatInfo(const string& platID, std::string& dist)
{
	if (g_pInst == NULL || !g_pInst->CanUse())
	{
		return false;
	}

// 	if (uid != 2928562105553271)
// 	{
// 		return false;
// 	}

	int     dbid    = g_pInst->GetServerId(platID);
	TCRDB*  pConn   = g_pInst->GetDB(dbid);
	if (pConn == NULL)
	{
		g_pInst->SetEnbale(false);
		LOG4CXX_ERROR(logger,"memcache_get_connect_null_error");
		return false;
	}

	
	int len  = 0;
	int klen = platID.length();
	char* buffer = (char*)tcrdbget(pConn, platID.c_str(), klen, &len);
	if (buffer == NULL)
	{
		int ecode = tcrdbecode(pConn);
		if (ecode != TTENOREC)
		{
			g_pInst->SetEnbale(false);
			LOG4CXX_ERROR(logger,"memcache_get_ecode_error");
		}
		return false;
	}
	std::string outbuf(buffer, len);
	dist = outbuf;
	free(buffer);	
	//g_pInst->GetCounter().increase("mem_get_user");
	return true;
}
开发者ID:CrazyPro,项目名称:ape,代码行数:41,代码来源:MemCacheServerHandler.cpp

示例3: getAvatar

bool getAvatar(const std::string &db_path, const std::string &name, std::string &photo) {
	bool ret = false;
	sqlite3 *db;
	LOG4CXX_INFO(logger, "Opening database " << db_path);
	if (sqlite3_open(db_path.c_str(), &db)) {
		sqlite3_close(db);
		LOG4CXX_ERROR(logger, "Can't open database");
	}
	else {
		sqlite3_stmt *stmt;
		PREP_STMT(stmt, "SELECT avatar_image FROM Contacts WHERE skypename=?");
		if (stmt) {
			BEGIN(stmt);
			BIND_STR(stmt, name);
			if(sqlite3_step(stmt) == SQLITE_ROW) {
				int size = sqlite3_column_bytes(stmt, 0);
				if (size > 0) {
				    const void *data = sqlite3_column_blob(stmt, 0);
				    photo = std::string((const char *)data + 1, size - 1);
				    ret = true;
				} else {
				    ret = false;
				}
			}
			else {
				LOG4CXX_ERROR(logger, (sqlite3_errmsg(db) == NULL ? "" : sqlite3_errmsg(db)));
			}

			int ret;
			while((ret = sqlite3_step(stmt)) == SQLITE_ROW) {
			}
			FINALIZE_STMT(stmt);
		}
		else {
			LOG4CXX_ERROR(logger, "Can't create prepared statement");
			LOG4CXX_ERROR(logger, (sqlite3_errmsg(db) == NULL ? "" : sqlite3_errmsg(db)));
		}
		sqlite3_close(db);
	}
	return ret;
}
开发者ID:cure,项目名称:libtransport,代码行数:41,代码来源:skypedb.cpp

示例4: while

/*
   Blocks until data can be written.
   If no data can be written in 2ms*100 the stream gets restarted.
   returns the amount of data that can be written.
*/
unsigned int PortAudio::getWriteAvailable()
{
    size_t writeAvailable = 0;
    int waitCount = 0;
    int failCount = 0;

    while( writeAvailable == 0 ) {
        writeAvailable = ringbuf.getWriteAvailable();

        if( writeAvailable == 0 ) {
            usleep(200000); //200 ms
            //LOG4CXX_DEBUG(narratorPaLog, "getWriteAvailable = 0, Pa_IsStreamActive = " << Pa_IsStreamActive(pStream));
        }

        if(waitCount++ > 10) {
            LOG4CXX_ERROR(narratorPaLog, "getWriteAvailable waittime exceeded, restarting stream");

            mError = Pa_AbortStream(pStream);
            // If abortstream fails, try reopening
            if(failCount++ > 0 || ( mError != paNoError && mError != paStreamIsStopped )) {
                LOG4CXX_ERROR(narratorPaLog, "Failed to abort stream, trying to close and reopen: " << Pa_GetErrorText(mError));

                mError = Pa_CloseStream(pStream);
                if(mError != paNoError)
                    LOG4CXX_ERROR(narratorPaLog, "Failed to close stream: " << Pa_GetErrorText(mError));

                isOpen = false;
                open(mRate, mChannels);
            }

            mError = Pa_StartStream(pStream);
            if(mError != paNoError) LOG4CXX_ERROR(narratorPaLog, "Failed to start stream: " << Pa_GetErrorText(mError));
            isStarted = true;

            waitCount = 0;
        }
    }

    //LOG4CXX_DEBUG(narratorPaLog, "getWriteAvailable = " << writeAvailable << ", Pa_IsStreamActive = " << Pa_IsStreamActive(pStream));
    return writeAvailable;
}
开发者ID:kolibre,项目名称:libkolibre-narrator,代码行数:46,代码来源:PortAudio.cpp

示例5: LOG4CXX_ERROR

bool MyCacheServer::loadConfig(const std::string& cfg, const std::string& servernode)
{
	try 
	{
		config = YAML::LoadFile(cfg)[servernode];

		address_ = config["listen"].as<std::string>();
		if (address_.empty())
		{
			LOG4CXX_ERROR(logger, "loadConfig failed: " << cfg << ": no listen");
			return false;
		}

		workernum_ = config["workers"].as<int>();
		if (workernum_ == 0)
		{
			workernum_ = 1;
		}

		if (config["caches"].size() == 0 || config["databases"].size() == 0)
		{
			LOG4CXX_ERROR(logger, "loadConfig failed: " << cfg << ": no caches/databases");
			return false;
		}

		s_tablenum = config["tablenums"].as<int>();
		if (s_tablenum == 0)
			s_tablenum = 10;

		s_cacheonly = config["cacheonly"].as<int>();

		return true;

	}
	catch (const std::exception& err)
	{
		LOG4CXX_ERROR(logger, "loadConfig failed: " << cfg << ": "<< err.what());
	}

	return false;
}
开发者ID:david-pp,项目名称:tinyworld,代码行数:41,代码来源:mycached.cpp

示例6: GetApplicationDataPath

std::string GetApplicationDataPath(const char* applicationName,const char* version)
{
  string versionSuffix;
  if(version && strlen(version) > 0)
    versionSuffix = string("\\")+string(version);
  TCHAR szPath[MAX_PATH];
  if(SUCCEEDED(SHGetFolderPath(NULL,CSIDL_APPDATA,NULL,0,szPath))) {
    return string(szPath)+string("\\")+string(applicationName)+versionSuffix;
  }
    LOG4CXX_ERROR(KrisLibrary::logger(),"GetApplicationDataPath: SHGetFolderPath failed? returning local folder\n");
  return string(applicationName)+versionSuffix;
}
开发者ID:krishauser,项目名称:KrisLibrary,代码行数:12,代码来源:apputils.cpp

示例7: curl_easy_setopt

void HTTPRequest::setProxy(std::string IP, std::string port, std::string username, std::string password) {
	if (curlhandle) {
		std::string proxyIpPort = IP + ":" + port;
		curl_easy_setopt(curlhandle, CURLOPT_PROXY, proxyIpPort.c_str());
		if (username.length() && password.length()) {
			std::string proxyUserPass = username + ":" + password;
			curl_easy_setopt(curlhandle, CURLOPT_PROXYUSERPWD, proxyUserPass.c_str());
		}
	} else {
		LOG4CXX_ERROR(logger, "Trying to set proxy while CURL isn't initialized");
	}
}
开发者ID:hanzz,项目名称:spectrum2,代码行数:12,代码来源:HTTPRequest.cpp

示例8: LOG4CXX_ERROR

std::set<std::string> UserDB::getRegisteredUsers()
{
	std::string q = "select user from users";
	if(exe(q) != SQLITE_OK) {
		LOG4CXX_ERROR(logger, "Failed to registered users from database!");
		exit(0);
	}
	
	std::set<std::string> users;
	for(int i=0 ; i<data.size() ; i++)
		users.insert(data[i][0]);
	return users;
}
开发者ID:jadestorm,项目名称:libtransport-debian,代码行数:13,代码来源:userdb.cpp

示例9: sqlite3_reset

void SQLite3Backend::setUser(const UserInfo &user) {
	sqlite3_reset(m_setUser);
	sqlite3_bind_text(m_setUser, 1, user.jid.c_str(), -1, SQLITE_STATIC);
	sqlite3_bind_text(m_setUser, 2, user.uin.c_str(), -1, SQLITE_STATIC);
	sqlite3_bind_text(m_setUser, 3, user.password.c_str(), -1, SQLITE_STATIC);
	sqlite3_bind_text(m_setUser, 4, user.language.c_str(), -1, SQLITE_STATIC);
	sqlite3_bind_text(m_setUser, 5, user.encoding.c_str(), -1, SQLITE_STATIC);
	sqlite3_bind_int (m_setUser, 6, user.vip);

	if(sqlite3_step(m_setUser) != SQLITE_DONE) {
		LOG4CXX_ERROR(logger, "setUser query"<< (sqlite3_errmsg(m_db) == NULL ? "" : sqlite3_errmsg(m_db)));
	}
}
开发者ID:mesu-im,项目名称:libtransport,代码行数:13,代码来源:sqlite3backend.cpp

示例10: LOG4CXX_ERROR

void client_socket_utils::session_connect(socket_session_ptr pSession)
{
	std::string& addr = pSession->get_remote_addr();
	try
	{
		//注册关闭回调函数
		pSession->installCloseCallBack(boost::bind(&client_socket_utils::close_callback, this, _1));
		//注册读到数据回调函数
		pSession->installReadDataCallBack(boost::bind(&client_socket_utils::read_data_callback, this, _1, _2, _3));

		std::vector<std::string> ip_port;
		boost::split(ip_port, addr, boost::is_any_of(":"));

		if (ip_port.size() < 2)
		{
			//throw std::runtime_error("ip 格式不正确!");
			LOG4CXX_ERROR(firebird_log, "[" << addr << "] ip 格式不正确!");
			return;
		}

		tcp::resolver resolver(pSession->socket().get_io_service());
		tcp::resolver::query query(ip_port[0], ip_port[1]);
		tcp::resolver::iterator endpoint_iterator = resolver.resolve(query);
		//pSession->set_begin_endpoint(endpoint_iterator);//设置起始地址,以便重连

		//由于客户端是不断重连的,即使还未连接也要保存该session
		m_manager.add_session(pSession);

		tcp::endpoint endpoint = *endpoint_iterator;
		pSession->socket().async_connect(endpoint,
				boost::bind(&client_socket_utils::handle_connect, this, boost::asio::placeholders::error, ++endpoint_iterator, pSession));
	} catch (std::exception& e)
	{
		LOG4CXX_ERROR(firebird_log, KDS_CODE_INFO << "连接远程地址:[" << addr << "],socket异常:[" << e.what() << "]");
	} catch (...)
	{
		LOG4CXX_ERROR(firebird_log, KDS_CODE_INFO << "连接远程地址:[" << addr << "],socket异常:[未知异常]");
	}
}
开发者ID:piaoyimq,项目名称:CppSpace,代码行数:39,代码来源:client_socket_utils.cpp

示例11: LOG4CXX_ERROR

void Connection::cleanup()
{
    LOG4CXX_ERROR(logger, mInstanceName << " cleaning up");
    
    mReceiverThread->requestStop();
    mSenderThread->requestStop();
    
    // Wake up processor threads blocked in I/O operation
    try 
    {
        mSocket->shutdown();
    } 
    catch (aqlib::Exception ex) 
    {
        LOG4CXX_ERROR(logger, mInstanceName << ": " << ex.toString());
    }
    
    mReceiverThread->join();
    mSenderThread->join();
    
    LOG4CXX_ERROR(logger, mInstanceName << " cleaned up");
}
开发者ID:aquarians,项目名称:AQuaRiAnS,代码行数:22,代码来源:Connection.cpp

示例12: Pa_StopStream

long PortAudio::stop()
{
    if(isStarted) {
        mError = Pa_StopStream(pStream);
        if(mError != paNoError)
            LOG4CXX_ERROR(narratorPaLog, "Failed to stop stream: " << Pa_GetErrorText(mError));

        ringbuf.flush();
        isStarted = false;
    }

    return mLatency;
}
开发者ID:kolibre,项目名称:libkolibre-narrator,代码行数:13,代码来源:PortAudio.cpp

示例13: getFdFromId

bool PlatNetHandler::sendEventToAllGamed(Event *e)
{
	bool succ = true;
	for (int i=1; i<=serverConfig.gamedNum(); i++) {
		int fd = getFdFromId(i);
		if (fd<0) {
			LOG4CXX_ERROR(logger_, "Get Fd from ID failed!! gamed:"<<i<<" fd:"<<" cmd:"<<e->cmd());
			continue;
		}
		string text;
		e->SerializeToString(&text);
		text = "ev,"+text;
		//LOG4CXX_DEBUG(logger_, "event:"<<e->DebugString()<<"to fd:"<<fd<<" with size:"<<text.length());
		bool sendSucc = sendIntSizedFdString(fd, text);
		if (!sendSucc) {
			LOG4CXX_ERROR(logger_, "Write to cache failed!!");
		}
		//LOG4CXX_DEBUG(logger_, "sendEventToAllGamed, event: " << e->cmd() << ", size: " << text.size() << ", target fd: " << fd << ", write to cache: " << sendSucc);
		succ = succ && sendSucc;
	}
	return succ;
}
开发者ID:CrazyPro,项目名称:ape,代码行数:22,代码来源:PlatNetHandler.cpp

示例14: LOG4CXX_ERROR

	int QFSFileHelper::Read(char *buffer, int length) {
		int bytes_read = qfshelper->kfsClient->Read(fd, buffer, length);
		if(bytes_read != length) {
			if(bytes_read < 0) {
				LOG4CXX_ERROR(logger, "Failure while reading file " << filename << " ERROR : " << KFS::ErrorCodeToStr(bytes_read));
				THROW_EXCEPTION(AppendStoreReadException, "Failed while reading file " + filename + " ERROR : " + KFS::ErrorCodeToStr(bytes_read));
			}
			else {
				LOG4CXX_ERROR(logger, "Less number of bytes read from file than specified")
			}
		}
		return bytes_read;	
	}
开发者ID:prakashchandrasekaran,项目名称:bigarchive,代码行数:13,代码来源:qfs_file_helper.cpp

示例15: LOG4CXX_INFO

long MessageHandler::insertAudio(long translationid, const MessageAudio &ma)
{
    LOG4CXX_INFO(narratorMsgHlrLog, "Inserting new messageaudio for translation with id: " << translationid);
    LOG4CXX_DEBUG(narratorMsgHlrLog, "tagid: " << ma.getTagid() << ", uri: " << ma.getUri() << ", md5: " << ma.getMd5() << ", size: " << ma.getSize() << ", length: " << ma.getLength() << ", encoding: " << ma.getEncoding());

    int audioid = -1;

    if(ma.isAudioDataNil()) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "No audio data has been set");
        return -1;
    }

    if(!db->prepare("INSERT INTO messageaudio (translation_id, tagid, text, length, encoding, data, size, md5) VALUES (?, ?, ?, ?, ?, ?, ?, ?)")) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    if(!db->bind(1, translationid) ||
            !db->bind(2, ma.getTagid()) ||
            !db->bind(3, ma.getText().c_str()) ||
            !db->bind(4, ma.getLength()) ||
            !db->bind(5, ma.getEncoding().c_str()) ||
            !db->bind(6, ma.getAudioData(), ma.getSize()) ||
            !db->bind(7, (long)ma.getSize()) ||
            !db->bind(8, ma.getMd5(), 32, NULL)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Bind failed '" << db->getLasterror() << "'");
        return -1;
    }

    narrator::DBResult result;
    if(!db->perform(&result)) {
        LOG4CXX_ERROR(narratorMsgHlrLog, "Query failed '" << db->getLasterror() << "'");
        return -1;
    }

    audioid = result.getInsertId();

    return audioid;
}
开发者ID:SparseMind,项目名称:libkolibre-narrator,代码行数:39,代码来源:MessageHandler.cpp


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