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


C++ LogFile::startlog方法代码示例

本文整理汇总了C++中LogFile::startlog方法的典型用法代码示例。如果您正苦于以下问题:C++ LogFile::startlog方法的具体用法?C++ LogFile::startlog怎么用?C++ LogFile::startlog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LogFile的用法示例。


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

示例1: main

// * ================================================================================ *
// @ main
// * ================================================================================ *
int main(int argc, char ** argv)
{
	//open the log file
	pLogFile = &CCLogFile;
	CCLogFile.startlog(1);
	CCLogFile.SetLogSize(2*1000*1000);
	CCLogFile.SetLoglevel(1);
	CCLogFile.logopen();
	
	if ( myconfig.readfile(CONFIG_FILE_PATH) == 0 )
	{
		printf("appserver: read config file '%s' error\n", CONFIG_FILE_PATH);
		LOG(LOG1, "appserver: read config file '%s' error\n", CONFIG_FILE_PATH);
		sleep(2);
		exit(0);
	}
	
	CCLogFile.SetLoglevel(ToInt(myconfig["LogLevel"][1]));
	
	
	//TANG 2010-9-4 11:02
	//处理命令行参数
	if ( argc == 3 && strcmp(argv[1], "reload") == 0 && strcmp(argv[2], "config") == 0 )
	{
		send_msg_reload_config("127.0.0.1", (( ToInt(myconfig["AppServerListenPort"][1]) > 0 ) ? ToInt(myconfig["AppServerListenPort"][1]) : 4016));
		exit(0);
	}
	
	
	LOG(LOG1, "appserver: start\n");
	
	child_process_init(SN3_SERVICE_NUMBER);
	
	//application_envinit();
	//LOG(LOG1, "appserver: application_envinit() done\n");

	_appserver_initial();
	LOG(LOG1, "appserver: _appserver_initial() done\n");

	nthread_create(thread_sockserver, NULL, 64*1024);
	nthread_create(thread_procdata_sendsmsg, NULL, 64*1024);
	
	tcp_server1.SetpLog(&CCLogFile);
	tcp_server1.SetCallBackFunc(deal_client_msg);
	if ( ToInt(myconfig["AppServerListenPort"][1]) > 0 )
	{
		tcp_server1.Listen(ToInt(myconfig["AppServerListenPort"][1]), 180);
	}
	else
	{
		tcp_server1.Listen(4016, 180);
	}

	//NPOSITION pos;
	//rundata_realtest* p_runtest;
	
	string s_terminal, s_msg_type;
	
	time_t t_check_hb_timeout = time(NULL);
	time_t t_check_test_timeout = time(NULL);
	
	while(g_appserver.m_runing)
	{
		child_process_hb(SN3_SERVICE_NUMBER);
		
		/*
		pos = NULL;
		while(NULL != (p_runtest = realtest_next(pos))) 
		{
			if ( time(NULL) >= p_runtest->tm_end )
			{
				CClientMsg::ansy_getitem(p_runtest->s_testdata.c_str(), "terminal", s_terminal);
				CClientMsg::ansy_getitem(p_runtest->s_testdata.c_str(), "msg", s_msg_type);
				
				//PESQ的实时测试,ftp扫描单元可能直接修改数据库的测试结果为X
				CNString sql;
				sql.Format("select * from BUSSOP where BUSSOP_ID = '%s' and (STATUS != 'X' and STATUS != 'Y');", p_runtest->s_bussopid.c_str());
				DATASET dbresult;
				if ( DB1.db_select(sql.c_str(), dbresult, LOG6) > 0 )
				{
					LOG(LOG1, "测试超时 [%s] '%c', s_bussopid='%s', timeout=%ds\n\n", 
						s_terminal.c_str(), 
						p_runtest->u_buss, 
						p_runtest->s_bussopid.c_str(), 
						p_runtest->tm_end - p_runtest->tm_start
						);
					
					int i_rescode = 1;
					if ( dbresult[0]["STATUS"] == "W" ) i_rescode = 5001;
					
					appserver_dbupdate_bussop_error(p_runtest->s_bussopid.c_str(), i_rescode);
				}
				
				t_uchar u_buss = p_runtest->u_buss;
				
				p_runtest = realtest_next(pos);
				
//.........这里部分代码省略.........
开发者ID:rock007,项目名称:hello,代码行数:101,代码来源:appserver.cpp


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