Browse Source

修改连接日志打印

k 2 years ago
parent
commit
0bb484ff3a

+ 1 - 0
src/main/java/com/jwk/spring/boot/modbus4j/ModbusRtuMaster.java

@@ -69,6 +69,7 @@ public class ModbusRtuMaster extends SerialPortWrapperImpl {
                 master = modbusFactory.createRtuMaster(this);
                 master.init();
                 modbusMasterUtil = new ModbusMasterUtil(master);
+                log.info("当前串口:{},打开成功!", getPort());
                 break;
             } catch (Exception e) {
                 log.error("当前串口:{},打开失败!", getPort(), e);

+ 1 - 1
src/main/java/com/jwk/spring/boot/modbus4j/ModbusTcpMaster.java

@@ -69,7 +69,7 @@ public class ModbusTcpMaster {
                 master = modbusFactory.createTcpMaster(params, true);
                 master.init();
                 modbusMasterUtil = new ModbusMasterUtil(master);
-                log.error("ModbusTcp:{}:{},连接成功!", getHost(), getPort());
+                log.info("ModbusTcp:{}:{},连接成功!", getHost(), getPort());
                 break;
             } catch (Exception e) {
                 log.error("ModbusTcp:{}:{},连接失败!", getHost(), getPort(), e);