• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LOG4CPLUS_TEXT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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();
}
开发者ID:Luxoft,项目名称:iviLink,代码行数:33,代码来源:testMain.cpp


示例2: testDirectory

	bool TestManager::RunTest(const char* path)
	{
		bool ok;
		TestParser testParser;
		Test *test = testParser.ParseTest(path);
		if (test != NULL)
		{
			// making log directory within tests directory:
			string testDirectory(path);
			testDirectory = testDirectory.substr(0, testDirectory.rfind(PATH_SEPARATOR) + 1);
			testDirectory.append(LOGS_DIRECTORY);
#ifdef _WIN32
			_mkdir(testDirectory.c_str());
#else
			mkdir(testDirectory.c_str(), S_IRWXU);
#endif

			// setting log file name:
			tstring fileName(LOG4CPLUS_TEXT(path));
			fileName.append(LOG4CPLUS_TEXT(".log"));
			size_t lastSeparatorIndex = fileName.rfind(PATH_SEPARATOR);
			fileName.insert(lastSeparatorIndex, 1, PATH_SEPARATOR);
			fileName.insert(lastSeparatorIndex + 1, LOGS_DIRECTORY);

			// configuring logger:
			PropertyConfigurator baseConfig(TESTER_LOG_CONFIG);
			helpers::Properties baseProperties = baseConfig.getProperties();
			helpers::Properties* properties = new helpers::Properties();
			vector<tstring> propertyNames = baseProperties.propertyNames();
			for (vector<string>::iterator it = propertyNames.begin(); it != propertyNames.end(); it++)
			{
				tstring key("log4cplus.");
				key.append(it->c_str());
				properties->setProperty(key, baseProperties.getProperty(it->c_str()));
			}

			properties->setProperty(LOG4CPLUS_TEXT("log4cplus.appender.RaccoonTestFileAppender.File"), fileName);

			Logger logger = Logger::getInstance(TESTER_LOGGER_NAME);
			SharedAppenderPtrList list = logger.getAllAppenders();
			PropertyConfigurator config(*properties);
			config.configure();
			for (SharedAppenderPtrList::iterator it = list.begin(); it != list.end(); it++)
			{
				logger.addAppender(*it);
			}

			LOG4CPLUS_INFO(logger, "Testing " << path << "...");
			ok = RunTest(*test);
			delete test;
			delete properties;
			logger.removeAppender(FILE_APPENDER_NAME);
		}
		else
		{
			ok = false;
		}

		return ok;
	}
开发者ID:SlavaC1,项目名称:ControlSW,代码行数:60,代码来源:TestManager.cpp


示例3: LOG4CPLUS_TEXT

	UINT32 Log4CPlusAdaptee::CreateLog( const char * pName , const char * pLayoutConfig , const char * pFile )
	{
		//5 1.创建layout,这里是先定义Layout的格式.
		log4cplus::tstring pattern = LOG4CPLUS_TEXT("");
		if (!pLayoutConfig)
		{
			pattern = LOG4CPLUS_TEXT("%d{%m/%d/%y %H:%M:%S,%Q} [%t] %-5p %c{2} %%%x%% - %X{key} - %m [%l]%n");
		} 

		//5 2.创建接纳Layout的appender.这个是用来表示是用来什么方式进行存储.可以流式.sys服务.远程服务.文件等等.
#ifdef _DEBUG
		log4cplus::SharedAppenderPtr pAppender(new log4cplus::ConsoleAppender()); 
		pAppender->setName(LOG4CPLUS_TEXT("log4cplus console appender"));
#else
		log4cplus::SharedAppenderPtr pAppender(new log4cplus::FileAppender(LOG4CPLUS_TEXT("log4cplus file appender")));
#endif
		pAppender->setLayout(std::auto_ptr<log4cplus::Layout>(new log4cplus::PatternLayout(pattern)));

		//5 3.创建Categteoy策略来装Appender.
		log4cplus::Logger objLogger = log4cplus::Logger::getInstance(log4cplus::helpers::towstring(pName));

		objLogger.setAdditivity(false);
		objLogger.addAppender(pAppender);
		objLogger.setLogLevel(log4cplus::ALL_LOG_LEVEL);

		return 0;
	} 
开发者ID:woopengcheng,项目名称:BasicLib,代码行数:27,代码来源:Log4CPlusAdaptee.cpp


示例4: 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


示例5: main

int main()
{
    log4cplus::Initializer initializer;
    log4cplus::BasicConfigurator config;
    config.configure();

    log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
    LOG4CPLUS_WARN(logger, LOG4CPLUS_TEXT("Hello, World!"));
    return 0;
}
开发者ID:lzxbill7,项目名称:myleet,代码行数:10,代码来源:loghelloworld.cpp


示例6: main

int main( int argc, char **argv)
{
    Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("ConnectivityAgent.main.test"));
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

    CppUnit::TextUi::TestRunner runner;
    CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
    runner.addTest( registry.makeTest() );
    bool wasSucessful = runner.run( "", false );
    return wasSucessful ? 0 : 1;
}
开发者ID:babenkoav78,项目名称:iviLink,代码行数:11,代码来源:testmain.cpp


示例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);
}
开发者ID:qualibit,项目名称:rtspmjpegclient,代码行数:53,代码来源:rtspmjpegclient.cpp


示例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...");
    }
}
开发者ID:qualibit,项目名称:rtspmjpegclient,代码行数:13,代码来源:rtspmjpegclient.cpp


示例9: main

int main(int argc, char* argv[])
{
   Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("ConnectivityAgent.test.client.main"));

   PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

   int option_index = 0;
   int c;

   while (true)
   {
      c = getopt_long(argc, argv, "x:u:r:p:", long_options, &option_index);

      if (-1 == c)
         break;

      switch (c)
      {
      case 'u':
         //Log("option u = '%s'", optarg);
         strncpy(ca_sock_path.begin(), optarg, ca_sock_path.size());
         ca_sock_path[ca_sock_path.size() - 1] = 0;
         break;
      default:
         //Log("unknown param %c (%d)", c, c);
         exit(1);
         break;
      }
   }

   if (ca_sock_path[0] != 0)
   {
      extern char const * gpCA_UNIX_SOCK_PATH;
      gpCA_UNIX_SOCK_PATH = ca_sock_path.begin();
   }

   // please run client first
   CSignalSemaphoreInterproc::unlink("/connectivity_agent_test_server");
   CSignalSemaphoreInterproc::unlink("/connectivity_agent_test_client");

   CClient client;
   client.threadFunc();
   // client.start();
   // while(true)
   // {	

   //    sleep(1000);
   // };
}
开发者ID:Luxoft,项目名称:iviLink,代码行数:49,代码来源:TestClientApp.cpp


示例10: main

int main()
{
   Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("samples.Applications.EchoServer"));
   PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("echoServerLog.properties"));

   LOG4CPLUS_INFO(logger, " begin Echo Client main()");

   EchoServer * server = new EchoServer();
   server->run();
   delete server;
   
   LOG4CPLUS_INFO(logger, "end Echo Client main()");

   return 0;
}
开发者ID:saphina,项目名称:iviLink,代码行数:15,代码来源:main.cpp


示例11: LOG4CPLUS_INFO

bool	NuiSLAMPointCloud::estimateNormals(NuiKinfuXYZRGB* pXYZRGB, float filterLeafSize)
{
	if (!pXYZRGB)
		return false;

	if (filterLeafSize <= 0.0f)
		return false;

	LOG4CPLUS_INFO(NuiLogger::instance().consoleLogger(), LOG4CPLUS_TEXT("Estimating normals..."));

	pcl::VoxelGrid<pcl::PointXYZRGB> sor;
	sor.setInputCloud(pXYZRGB->getPtr());
	sor.setLeafSize(filterLeafSize, filterLeafSize, filterLeafSize);

	pcl::PointCloud<pcl::PointXYZRGB> tempCloud;
	sor.filter(tempCloud);

	pcl::NormalEstimation<pcl::PointXYZRGB, pcl::Normal> n;
	pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
	pcl::search::KdTree<pcl::PointXYZRGB>::Ptr tree(new pcl::search::KdTree<pcl::PointXYZRGB>);

	tree->setInputCloud(tempCloud.makeShared());

	n.setInputCloud(tempCloud.makeShared());
	n.setSearchMethod(tree);
	n.setKSearch(20);
	n.compute(*normals);

	pcl::concatenateFields(tempCloud, *normals, m_pointCloud);

	return true;
}
开发者ID:hustztz,项目名称:NatureUserInterfaceStudio,代码行数:32,代码来源:NuiSLAMPointCloud.cpp


示例12:

bool LobbyServer::InitLog4cpp()
{
	PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("./lobby.properties"));
	Logger root = Logger::getRoot();

	return true;
}
开发者ID:lovemychobits,项目名称:c2p_server,代码行数:7,代码来源:LobbyServer.cpp


示例13: MockTransportManagerClient

 MockTransportManagerClient(ITransportManager & TransportManager)
 : mTransportManager(TransportManager)
 , mDeviceList()
 , mLogger(log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("TransportManagerTest")))
 {
     
 }
开发者ID:AByzhynar,项目名称:sdl_core_winport,代码行数:7,代码来源:TransportManagerTestWithCorrectDeviceAdapter.cpp


示例14: getDeviceHandle

namespace NsConnectionHandler
{

    log4cplus::Logger CDevice::mLogger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("ConnectionHandler"));

    CDevice::CDevice(tDeviceHandle aDeviceHandle, std::string aUserFriendlyName):
    mDeviceHandle(aDeviceHandle),
    mUserFriendlyName(aUserFriendlyName)
    {

    }

    CDevice::~CDevice()
    {
        
    }

    tDeviceHandle CDevice::getDeviceHandle() const
    {
        return mDeviceHandle;
    }

    std::string CDevice::getUserFriendlyName() const
    {
        return mUserFriendlyName;
    }
}/* namespace NsConnectionHandler */
开发者ID:Luxoft,项目名称:SDLP,代码行数:27,代码来源:CDevice.cpp


示例15: mVideoWidget

CPlayer::CPlayer()
    : mVideoWidget(0),
      mMediaPlayer(NULL),
      mPlaybackStartedCallback(NULL)
{
    LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));
    mMutex = new CRWMutex();
    const char * const argv[] = {
        "--no-video-title-show",
        "-vvv",
        "--packetizer-mpegvideo-sync-iframe"
    };
    mInst = libvlc_new(sizeof(argv) / sizeof(*argv), argv);
    assert(mInst);
    mVolume = VOLUME_INIT;
    hasPlayerInstance = false;
    //for process show and hide in qt-threads
    if (connect(this, SIGNAL(playerPlaySig(QString, QString)), this, SLOT(playerPlaySlot(QString, QString)), Qt::QueuedConnection) == false)
    {
        LOG4CPLUS_INFO(msLogger, "qt - connect play failed!");
        killProcess(1);
    }
    if (connect(this, SIGNAL(playerStopSig()), this, SLOT(playerStopSlot()), Qt::QueuedConnection) == false)
    {
        LOG4CPLUS_INFO(msLogger, "qt - connect  stop failed!");
        killProcess(1);
    }
}
开发者ID:saphina,项目名称:iviLink,代码行数:29,代码来源:CPlayer.cpp


示例16: avcodec_close

void RTSPMJPEGClient::_clean(RTSPMJPEGClientStruct *pClient, int stateToSet)
{
    // close the codecs
    if (pClient->_pCodecCtx != NULL)
    {
        avcodec_close(pClient->_pCodecCtx);
        pClient->_pCodecCtx = NULL;
    }

    if (pClient->_pCodecCtxOrig != NULL)
    {
        avcodec_close(pClient->_pCodecCtxOrig);
        pClient->_pCodecCtxOrig = NULL;
    }

    // close the video input
    if (pClient->_pFormatCtx != NULL)
    {
        avformat_close_input(&pClient->_pFormatCtx);
        pClient->_pFormatCtx = NULL;
    }

    pClient->state = stateToSet;

    pClient->isWaiting = false;
    pClient->newFramesNum = 0;

    LOG4CPLUS_TRACE(Logger::getInstance(LOG4CPLUS_TEXT(DEFAULT_OUTPUT_LOGGER)), "[CLIENT " << pClient->clientId << "] STATE = " << state_to_string(pClient->state));
}
开发者ID:qualibit,项目名称:rtspmjpegclient,代码行数:29,代码来源:rtspmjpegclient.cpp


示例17: CoreProtocolGetAvailableProfileComplementsResponse

CoreProtocolGetAvailableProfileComplementsResponse::
    CoreProtocolGetAvailableProfileComplementsResponse(PmpCore * core,
        const std::list<Profile::Uid> & complements)
    : mCore(core)
    , mComplements(complements)
,    mLogger(Logger::getInstance(LOG4CPLUS_TEXT("profileManager.PMP.Events")))
{
}
开发者ID:saphina,项目名称:iviLink,代码行数:8,代码来源:ProtocolEvents.cpp


示例18: InitLogger

void InitLogger(bool daemonized)  
{  
	initialize();
	if (daemonized)  
		PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("configLog.txt"));  
/*	else  
		PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("configLog.txt"));*/  
} 
开发者ID:wyrover,项目名称:DESKTOP-1,代码行数:8,代码来源:LogFile.cpp


示例19: mLogger

ServiceRepository::ServiceRepository(conf::Configurator * configurator)
    : mLogger(Logger::getInstance(LOG4CPLUS_TEXT("profileManager.Repository")))
    , mConfigurator(configurator)
{
    LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__ );
    init();
    printRepository();
}
开发者ID:Luxoft,项目名称:iviLink,代码行数:8,代码来源:ServiceRepository.cpp


示例20: main

GTEST_API_ int main(int argc,
                    char **argv) {
   InitializeLogging();
   log4cplus::Logger logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("main"));
   LOG4CPLUS_INFO(logger, "Running main()");
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
}
开发者ID:mitre,项目名称:FMACM,代码行数:8,代码来源:main.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LOG4CPLUS_TRACE_METHOD函数代码示例发布时间:2022-05-30
下一篇:
C++ LOG4CPLUS_ERROR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap