feat():修改日志打印方式

dev.eventProcess
LQS 2024-09-29 17:45:01 +08:00
parent 7e02675028
commit 514c94b398
2 changed files with 11 additions and 7 deletions

View File

@ -9,6 +9,7 @@ package com.muyu.common.core.constant;
* @Date2024/9/29 17:28 * @Date2024/9/29 17:28
*/ */
public class RedisConstants { public class RedisConstants {
/** /**
* redisKey() * redisKey()
*/ */

View File

@ -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();
} }
} }