feat():修改日志打印方式
parent
7e02675028
commit
514c94b398
|
@ -9,6 +9,7 @@ package com.muyu.common.core.constant;
|
||||||
* @Date:2024/9/29 17:28
|
* @Date:2024/9/29 17:28
|
||||||
*/
|
*/
|
||||||
public class RedisConstants {
|
public class RedisConstants {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* redisKey(协议解析报文传递)
|
* redisKey(协议解析报文传递)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -73,7 +73,8 @@ public class ParsingMQTT {
|
||||||
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.MESSAGE_PARSING,
|
ProducerRecord<String, String> producerRecord = new ProducerRecord<>(KafkaConstants.MESSAGE_PARSING,
|
||||||
entries.toString() );
|
entries.toString() );
|
||||||
kafkaProducer.send(producerRecord);
|
kafkaProducer.send(producerRecord);
|
||||||
System.out.println(entries);
|
log.info("解析之后的数据"+entries);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -115,13 +116,15 @@ public class ParsingMQTT {
|
||||||
redisKey, JSON.toJSONString(listResp)
|
redisKey, JSON.toJSONString(listResp)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
log.info("数据库查询成功");
|
log.info("数据库查询成功:"+byTemplateId);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
log.info("获取报文模板失败");
|
||||||
throw new RuntimeException("获取报文模板失败");
|
throw new RuntimeException("获取报文模板失败");
|
||||||
}
|
}
|
||||||
//判断报文模板列表不为空
|
//判断报文模板列表不为空
|
||||||
if (templateList.isEmpty()) {
|
if (templateList.isEmpty()) {
|
||||||
|
log.info("报文模版为空");
|
||||||
throw new RuntimeException("报文模版为空");
|
throw new RuntimeException("报文模版为空");
|
||||||
}
|
}
|
||||||
//存储报文模版解析后的数据
|
//存储报文模版解析后的数据
|
||||||
|
@ -146,11 +149,11 @@ public class ParsingMQTT {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (MqttException me) {
|
} catch (MqttException me) {
|
||||||
System.out.println("reason " + me.getReasonCode());
|
log.info("reason " + me.getReasonCode());
|
||||||
System.out.println("msg " + me.getMessage());
|
log.info("msg " + me.getMessage());
|
||||||
System.out.println("loc " + me.getLocalizedMessage());
|
log.info("loc " + me.getLocalizedMessage());
|
||||||
System.out.println("cause " + me.getCause());
|
log.info("cause " + me.getCause());
|
||||||
System.out.println("excep " + me);
|
log.info("excep " + me);
|
||||||
me.printStackTrace();
|
me.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue