fix log
This commit is contained in:
@@ -219,11 +219,14 @@ void RocketMQProducer::sendMessage(const std::string& body,
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
} catch (const MQClientException& e) {
|
} catch (const MQClientException& e) {
|
||||||
std::cerr << "[RocketMQProducer] 发送失败: " << e.what() << std::endl;
|
std::cerr << "[RocketMQProducer] 发送失败: " << e.what() << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
// 根据需要进行重试或日志记录
|
// 根据需要进行重试或日志记录
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "[RocketMQProducer] 异常: " << e.what() << std::endl;
|
std::cerr << "[RocketMQProducer] 异常: " << e.what() << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cerr << "[RocketMQProducer] 未知错误,消息发送失败。" << std::endl;
|
std::cerr << "[RocketMQProducer] 未知错误,消息发送失败。" << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,10 +247,13 @@ void RocketMQProducer::sendMessageOrderly(const std::string& body,
|
|||||||
<< std::endl;
|
<< std::endl;
|
||||||
} catch (const MQClientException& e) {
|
} catch (const MQClientException& e) {
|
||||||
std::cerr << "[RocketMQProducer] 顺序发送失败: " << e.what() << std::endl;
|
std::cerr << "[RocketMQProducer] 顺序发送失败: " << e.what() << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
std::cerr << "[RocketMQProducer] 异常: " << e.what() << std::endl;
|
std::cerr << "[RocketMQProducer] 异常: " << e.what() << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cerr << "[RocketMQProducer] 未知错误,顺序消息发送失败。" << std::endl;
|
std::cerr << "[RocketMQProducer] 未知错误,顺序消息发送失败。" << std::endl;
|
||||||
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_MQ, "MQ发送失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1037,7 +1043,7 @@ rocketmq::ConsumeStatus myMessageCallbackrtdata(const rocketmq::MQMessageExt& ms
|
|||||||
|
|
||||||
if (!parseJsonMessageRT(body, devid, line, realData, soeData, limit,idx)) {
|
if (!parseJsonMessageRT(body, devid, line, realData, soeData, limit,idx)) {
|
||||||
std::cerr << "Failed to parse the JSON message." << std::endl;
|
std::cerr << "Failed to parse the JSON message." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON, "主题:%s - tag:%s的实时触发消息失败", FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_RT.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON, "主题:%s - tag:%s的实时触发消息失败", G_MQCONSUMER_TOPIC_RT.c_str(), FRONT_INST.c_str());
|
||||||
return rocketmq::RECONSUME_LATER;
|
return rocketmq::RECONSUME_LATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1051,7 +1057,7 @@ rocketmq::ConsumeStatus myMessageCallbackrtdata(const rocketmq::MQMessageExt& ms
|
|||||||
if (ClientManager::instance().get_dev_status(devid) != 1) {
|
if (ClientManager::instance().get_dev_status(devid) != 1) {
|
||||||
std::cout << "devid对应装置不在线: " << devid << std::endl;
|
std::cout << "devid对应装置不在线: " << devid << std::endl;
|
||||||
// 记录日志不响应 web 端
|
// 记录日志不响应 web 端
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_COMM,"主题:%s - tag:%s的实时数据触发消息失败,装置%s不在线",FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_RT.c_str(),devid.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_COMM,"主题:%s - tag:%s的实时数据触发消息失败,装置%s不在线", G_MQCONSUMER_TOPIC_RT.c_str(),FRONT_INST.c_str(),devid.c_str());
|
||||||
return rocketmq::CONSUME_SUCCESS;
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1062,7 +1068,7 @@ rocketmq::ConsumeStatus myMessageCallbackrtdata(const rocketmq::MQMessageExt& ms
|
|||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
std::cerr << "rtdata is NULL." << std::endl;
|
std::cerr << "rtdata is NULL." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的补招触发消息失败",FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_RT.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的补招触发消息失败",G_MQCONSUMER_TOPIC_RT.c_str(),FRONT_INST.c_str());
|
||||||
return rocketmq::RECONSUME_LATER;
|
return rocketmq::RECONSUME_LATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1108,7 +1114,7 @@ rocketmq::ConsumeStatus myMessageCallbackupdate(const rocketmq::MQMessageExt& ms
|
|||||||
// 调用业务逻辑处理函数
|
// 调用业务逻辑处理函数
|
||||||
std::string updatefilepath = FRONT_PATH + "/etc/ledgerupdate";
|
std::string updatefilepath = FRONT_PATH + "/etc/ledgerupdate";
|
||||||
if (!parseJsonMessageUD(body, updatefilepath)) {
|
if (!parseJsonMessageUD(body, updatefilepath)) {
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的台账更新消息失败",FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_UD.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的台账更新消息失败",G_MQCONSUMER_TOPIC_UD.c_str(),FRONT_INST.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rocketmq::CONSUME_SUCCESS;
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
@@ -1196,7 +1202,7 @@ rocketmq::ConsumeStatus myMessageCallbacklog(const rocketmq::MQMessageExt& msg)
|
|||||||
|
|
||||||
// 执行日志上送处理
|
// 执行日志上送处理
|
||||||
if (!parseJsonMessageLOG(body)) {
|
if (!parseJsonMessageLOG(body)) {
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的日志上送消息失败",FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_LOG.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的日志上送消息失败",G_MQCONSUMER_TOPIC_LOG.c_str(),FRONT_INST.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rocketmq::CONSUME_SUCCESS;
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
@@ -2273,7 +2279,7 @@ rocketmq::ConsumeStatus cloudMessageCallback(const rocketmq::MQMessageExt& msg)
|
|||||||
|
|
||||||
if (!parseJsonMessageCLOUD(body, devid, guid, DetailObj,FrontId,Node)) {
|
if (!parseJsonMessageCLOUD(body, devid, guid, DetailObj,FrontId,Node)) {
|
||||||
std::cerr << "Failed to parse the JSON message." << std::endl;
|
std::cerr << "Failed to parse the JSON message." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON, "主题:%s - tag:%s的云前置控制消息失败", FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_RT.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON, "主题:%s - tag:%s的云前置控制消息失败", G_MQCONSUMER_TOPIC_CLOUD.c_str(), FRONT_INST.c_str());
|
||||||
return rocketmq::RECONSUME_LATER;
|
return rocketmq::RECONSUME_LATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2292,7 +2298,7 @@ rocketmq::ConsumeStatus cloudMessageCallback(const rocketmq::MQMessageExt& msg)
|
|||||||
|
|
||||||
if(!parsemsg(devid,guid,DetailObj)){
|
if(!parsemsg(devid,guid,DetailObj)){
|
||||||
std::cerr << "clouddata is error." << std::endl;
|
std::cerr << "clouddata is error." << std::endl;
|
||||||
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的云前置控制消息失败",FRONT_INST.c_str(), G_MQCONSUMER_TOPIC_RT.c_str());
|
DIY_ERRORLOG_CODE("process",0,LOG_CODE_JSON,"主题:%s - tag:%s的云前置控制消息失败",G_MQCONSUMER_TOPIC_CLOUD.c_str(),FRONT_INST.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return rocketmq::CONSUME_SUCCESS;
|
return rocketmq::CONSUME_SUCCESS;
|
||||||
|
|||||||
@@ -319,11 +319,11 @@ extern bool normalOutputEnabled;
|
|||||||
showinshellflag = true;
|
showinshellflag = true;
|
||||||
handleViewLogCommand(cmd, clientFD);
|
handleViewLogCommand(cmd, clientFD);
|
||||||
} else if (cmd.find("G_TEST_NUM=") == 0) {
|
} else if (cmd.find("G_TEST_NUM=") == 0) {
|
||||||
int num = std::atoi(cmd.substr(9).c_str());
|
int num = std::atoi(cmd.substr(11).c_str());
|
||||||
setTestNum(num);
|
setTestNum(num);
|
||||||
sendStr(clientFD, "\r\x1B[KTEST_NUM updated\r\n");
|
sendStr(clientFD, "\r\x1B[KTEST_NUM updated\r\n");
|
||||||
} else if (cmd.find("G_TEST_TYPE=") == 0) {
|
} else if (cmd.find("G_TEST_TYPE=") == 0) {
|
||||||
int type = std::atoi(cmd.substr(10).c_str());
|
int type = std::atoi(cmd.substr(12).c_str());
|
||||||
setTestType(type);
|
setTestType(type);
|
||||||
sendStr(clientFD, "\r\x1B[KTEST_TYPE updated\r\n");
|
sendStr(clientFD, "\r\x1B[KTEST_TYPE updated\r\n");
|
||||||
} else if (cmd.find("LOG=") == 0) {
|
} else if (cmd.find("LOG=") == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user