log4 add code and fix comtrade file pair
This commit is contained in:
@@ -2681,7 +2681,7 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
|
||||
cout << file_name << "!!!!!!!!!!!!!!!!!!!!!!!!!!" << save_name << endl;
|
||||
|
||||
//mq日志
|
||||
DIY_WARNLOG("process","【WARN】前置获取到终端类型%s,该终端类型对应的映射文件为%s,映射文件将下载并保存在本地为%s",TMNL_TYPE,FILE_PATH,save_name);
|
||||
DIY_WARNLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【WARN】前置获取到终端类型%s,该终端类型对应的映射文件为%s,映射文件将下载并保存在本地为%s",TMNL_TYPE,FILE_PATH,save_name);
|
||||
|
||||
//20241028 lnk 替换为文件下载web接口
|
||||
//构造文件下载接口参数
|
||||
@@ -2713,17 +2713,17 @@ void Set_xml_databaseinfo(char* MODEL_ID, char* TMNL_TYPE, char* FILE_PATH, char
|
||||
outFile.close();
|
||||
std::cout << "File saved successfully!" << std::endl;
|
||||
//mq日志
|
||||
DIY_WARNLOG("process","【WARN】前置下载映射文件%s成功",save_name);
|
||||
DIY_INFOLOG("process","【NORMAL】前置下载映射文件%s成功",save_name);
|
||||
} else {
|
||||
std::cerr << "Error: Unable to open file for writing." << std::endl;
|
||||
DIY_ERRORLOG("process","【ERROR】前置写入本地映射文件%s失败",save_name);
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置写入本地映射文件%s失败",save_name);
|
||||
}
|
||||
|
||||
// 释放分配的内存
|
||||
free(fileContent);
|
||||
} else {
|
||||
std::cerr << "Error: Unable to download file." << std::endl;
|
||||
DIY_ERRORLOG("process","【ERROR】前置调用文件下载接口下载远端文件文件%s失败",FILE_PATH);
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_ICD_AND_DOWNLOAD,"【ERROR】前置调用文件下载接口下载远端文件文件%s失败",FILE_PATH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3054,7 +3054,7 @@ static void writeJsonToFile(const char* filePath, const char* jsonString)
|
||||
{
|
||||
FILE* fp = fopen(filePath, "w");
|
||||
if (!fp) {
|
||||
DIY_ERRORLOG("process","【ERROR】无法将暂态事件写入本地缓存");
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法将暂态事件写入本地缓存");
|
||||
std::cerr << "Failed to write in file : " << filePath << std::endl;
|
||||
return;
|
||||
}
|
||||
@@ -3140,7 +3140,7 @@ static void scanAndResendOfflineFiles(const std::string &dirPath)
|
||||
// 读取文件内容(即之前存的 JSON)
|
||||
FILE* fp = fopen(fileList[i].fileName.c_str(), "r");
|
||||
if (!fp) {
|
||||
DIY_ERRORLOG("process","【ERROR】无法打开本地缓存的暂态事件");
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【ERROR】无法打开本地缓存的暂态事件");
|
||||
std::cerr << " fail to open exsist file " << fileList[i].fileName << std::endl;
|
||||
continue;
|
||||
}
|
||||
@@ -3168,12 +3168,12 @@ static void scanAndResendOfflineFiles(const std::string &dirPath)
|
||||
// 表示有响应,则可视为成功;根据项目需要可加更精细的判断
|
||||
handleCommentResponse(std::string(ptr));
|
||||
|
||||
DIY_WARNLOG("process","【WARN】前置重发暂态事件失败");
|
||||
DIY_WARNLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件失败");
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
DIY_WARNLOG("process","【WARN】前置重发暂态事件成功");
|
||||
DIY_WARNLOG_CODE("process",LOG_CODE_TRANSIENT_COMM,"【WARN】前置重发暂态事件成功");
|
||||
|
||||
std::cout << "old file send success,remove it" << std::endl;
|
||||
// 删除文件
|
||||
@@ -3283,7 +3283,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
||||
if (j_r == NULL) {
|
||||
|
||||
//mq日志
|
||||
DIY_ERRORLOG(full_key_m_d,"【ERROR】暂态接口响应异常,无法上送监测点%s的暂态事件",mp_id);
|
||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口响应异常,无法上送监测点%s的暂态事件",mp_id);
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
||||
@@ -3331,7 +3331,7 @@ char* mp_id,char* Qvvr_rptname,char* devtype)
|
||||
std::cout << "Error: Received NULL response" << std::endl;
|
||||
|
||||
//mq日志
|
||||
DIY_ERRORLOG(full_key_m_d,"【ERROR】暂态接口无响应,无法上送监测点%s的暂态事件",mp_id);
|
||||
DIY_ERRORLOG_CODE(full_key_m_d,LOG_CODE_TRANSIENT_COMM,"【ERROR】暂态接口无响应,无法上送监测点%s的暂态事件",mp_id);
|
||||
|
||||
std::cout << "qvvr send fail ,store in local" << std::endl;
|
||||
// 1) 先检查/FeProject/dat/qvvr/目录文件大小是否超过 10M,若超过则删除最老的一个文件
|
||||
|
||||
@@ -998,7 +998,7 @@ int parse_set(const std::string& json_str) {
|
||||
}
|
||||
execute_bash(fun, processNum, frontType);
|
||||
|
||||
DIY_WARNLOG("process","【WARN】前置的%s%d号进程执行指令:%s,reset表示重启所有进程,add表示添加进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
|
||||
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【WARN】前置的%s%d号进程执行指令:%s,reset表示重启所有进程,add表示添加进程",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
|
||||
|
||||
//脚本在3秒后执行
|
||||
//回复消息
|
||||
@@ -1020,7 +1020,7 @@ int parse_set(const std::string& json_str) {
|
||||
send_reply_to_kafka(guid,"1","收到删除进程指令,这个进程将会重启 ");
|
||||
|
||||
//上送日志
|
||||
DIY_WARNLOG("process","【WARN】前置的%s%d号进程执行指令:%s,即将重启",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
|
||||
DIY_WARNLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【WARN】前置的%s%d号进程执行指令:%s,即将重启",get_front_msg_from_subdir(), g_front_seg_index,fun.c_str());
|
||||
|
||||
apr_sleep(apr_time_from_sec(10));
|
||||
::_exit(-1039); //进程退出
|
||||
@@ -1796,7 +1796,7 @@ int myMessageCallbackrtdata(CPushConsumer* consumer, CMessageExt* msg)
|
||||
if (!parseJsonMessageRT(body, devid, line, realData, soeData, limit)) {
|
||||
std::cerr << "Failed to parse the JSON message." << std::endl;
|
||||
//记录日志
|
||||
DIY_ERRORLOG("process","【ERROR】前置消费topic:%s_%s的实时触发消息失败,消息的json格式不正确",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"【ERROR】前置消费topic:%s_%s的实时触发消息失败,消息的json格式不正确",FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RT.c_str());
|
||||
return E_RECONSUME_LATER;
|
||||
}
|
||||
|
||||
@@ -1814,7 +1814,7 @@ int myMessageCallbackrtdata(CPushConsumer* consumer, CMessageExt* msg)
|
||||
}
|
||||
// 创建 XML 文件
|
||||
if (!createXmlFile(dev_index, mp_index, realData, soeData, limit,"new")) {
|
||||
DIY_ERRORLOG("process","【ERROR】前置无法创建实时数据触发文件");
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RT_DATA,"【ERROR】前置无法创建实时数据触发文件");
|
||||
std::cerr << "Failed to create the XML file." << std::endl;
|
||||
return E_RECONSUME_LATER;
|
||||
}
|
||||
@@ -1855,7 +1855,7 @@ int myMessageCallbackupdate(CPushConsumer* consumer, CMessageExt* msg)
|
||||
//处理台账更新消息
|
||||
std::string updatefilepath = "/home/pq/FeProject/etc/ledgerupdate";
|
||||
if(parse_control(body,updatefilepath)){
|
||||
DIY_ERRORLOG("process","【ERROR】前置的%s%d号进程处理topic:%s_%s的台账更新消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LEDGER_UPDATE,"【ERROR】前置的%s%d号进程处理topic:%s_%s的台账更新消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_UD.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1891,7 +1891,7 @@ int myMessageCallbackset(CPushConsumer* consumer, CMessageExt* msg)
|
||||
|
||||
//处理进程更新消息
|
||||
if(parse_set(body)){
|
||||
DIY_ERRORLOG("process","【ERROR】前置的%s%d号进程处理topic:%s_%s的进程控制消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_PROCESS_CONTROL,"【ERROR】前置的%s%d号进程处理topic:%s_%s的进程控制消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_SET.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1927,7 +1927,7 @@ int myMessageCallbacklog(CPushConsumer* consumer, CMessageExt* msg)
|
||||
|
||||
//处理进程更新消息
|
||||
if(parse_log(body)){
|
||||
DIY_ERRORLOG("process","【ERROR】前置的%s%d号进程处理topic:%s_%s的日志上送消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_LOG.c_str());
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_LOG_REQUEST,"【ERROR】前置的%s%d号进程处理topic:%s_%s的日志上送消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_LOG.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1976,7 +1976,7 @@ int myMessageCallbackrecall(CPushConsumer* consumer, CMessageExt* msg)
|
||||
}
|
||||
else{
|
||||
std::cerr << "recall data is NULL." << std::endl;
|
||||
DIY_ERRORLOG("process","【ERROR】前置的%s%d号进程处理topic:%s_%s的补招触发消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RC.c_str());
|
||||
DIY_ERRORLOG_CODE("process",LOG_CODE_RECALL,"【ERROR】前置的%s%d号进程处理topic:%s_%s的补招触发消息失败,消息的json结构不正确",get_front_msg_from_subdir(), g_front_seg_index,FRONT_INST.c_str(),G_MQCONSUMER_TOPIC_RC.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user