Commit f7a2d2a92d7e25780c91dd74ecf52e094b62ef4c
1 parent
b92027f3
去除所有的system.print, 优化日志显示
Showing
21 changed files
with
124 additions
and
66 deletions
src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java
| ... | ... | @@ -22,6 +22,9 @@ public class MediaServerConfig { |
| 22 | 22 | @JSONField(name = "general.enableVhost") |
| 23 | 23 | private String generalEnableVhost; |
| 24 | 24 | |
| 25 | + @JSONField(name = "general.mediaServerId") | |
| 26 | + private String generalMediaServerId; | |
| 27 | + | |
| 25 | 28 | @JSONField(name = "general.flowThreshold") |
| 26 | 29 | private String generalFlowThreshold; |
| 27 | 30 | |
| ... | ... | @@ -738,4 +741,12 @@ public class MediaServerConfig { |
| 738 | 741 | public void setUpdateTime(long updateTime) { |
| 739 | 742 | this.updateTime = updateTime; |
| 740 | 743 | } |
| 744 | + | |
| 745 | + public String getGeneralMediaServerId() { | |
| 746 | + return generalMediaServerId; | |
| 747 | + } | |
| 748 | + | |
| 749 | + public void setGeneralMediaServerId(String generalMediaServerId) { | |
| 750 | + this.generalMediaServerId = generalMediaServerId; | |
| 751 | + } | |
| 741 | 752 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java
| ... | ... | @@ -39,6 +39,8 @@ import javax.sip.message.Request; |
| 39 | 39 | import javax.sip.message.Response; |
| 40 | 40 | |
| 41 | 41 | import gov.nist.core.InternalErrorHandler; |
| 42 | +import org.slf4j.Logger; | |
| 43 | +import org.slf4j.LoggerFactory; | |
| 42 | 44 | |
| 43 | 45 | /** |
| 44 | 46 | * Implements the HTTP digest authentication method server side functionality. |
| ... | ... | @@ -49,6 +51,8 @@ import gov.nist.core.InternalErrorHandler; |
| 49 | 51 | |
| 50 | 52 | public class DigestServerAuthenticationHelper { |
| 51 | 53 | |
| 54 | + private Logger logger = LoggerFactory.getLogger(DigestServerAuthenticationHelper.class); | |
| 55 | + | |
| 52 | 56 | private MessageDigest messageDigest; |
| 53 | 57 | |
| 54 | 58 | public static final String DEFAULT_ALGORITHM = "MD5"; |
| ... | ... | @@ -204,18 +208,18 @@ public class DigestServerAuthenticationHelper { |
| 204 | 208 | String A2 = request.getMethod().toUpperCase() + ":" + uri.toString(); |
| 205 | 209 | byte mdbytes[] = messageDigest.digest(A1.getBytes()); |
| 206 | 210 | String HA1 = toHexString(mdbytes); |
| 207 | - System.out.println("A1: " + A1); | |
| 208 | - System.out.println("A2: " + A2); | |
| 211 | + logger.debug("A1: " + A1); | |
| 212 | + logger.debug("A2: " + A2); | |
| 209 | 213 | |
| 210 | 214 | mdbytes = messageDigest.digest(A2.getBytes()); |
| 211 | 215 | String HA2 = toHexString(mdbytes); |
| 212 | - System.out.println("HA1: " + HA1); | |
| 213 | - System.out.println("HA2: " + HA2); | |
| 216 | + logger.debug("HA1: " + HA1); | |
| 217 | + logger.debug("HA2: " + HA2); | |
| 214 | 218 | String cnonce = authHeader.getCNonce(); |
| 215 | - System.out.println("nonce: " + nonce); | |
| 216 | - System.out.println("nc: " + ncStr); | |
| 217 | - System.out.println("cnonce: " + cnonce); | |
| 218 | - System.out.println("qop: " + qop); | |
| 219 | + logger.debug("nonce: " + nonce); | |
| 220 | + logger.debug("nc: " + ncStr); | |
| 221 | + logger.debug("cnonce: " + cnonce); | |
| 222 | + logger.debug("qop: " + qop); | |
| 219 | 223 | String KD = HA1 + ":" + nonce; |
| 220 | 224 | |
| 221 | 225 | if (qop != null && qop.equals("auth") ) { |
| ... | ... | @@ -228,12 +232,12 @@ public class DigestServerAuthenticationHelper { |
| 228 | 232 | KD += ":" + qop; |
| 229 | 233 | } |
| 230 | 234 | KD += ":" + HA2; |
| 231 | - System.out.println("KD: " + KD); | |
| 235 | + logger.debug("KD: " + KD); | |
| 232 | 236 | mdbytes = messageDigest.digest(KD.getBytes()); |
| 233 | 237 | String mdString = toHexString(mdbytes); |
| 234 | - System.out.println("mdString: " + mdString); | |
| 238 | + logger.debug("mdString: " + mdString); | |
| 235 | 239 | String response = authHeader.getResponse(); |
| 236 | - System.out.println("response: " + response); | |
| 240 | + logger.debug("response: " + response); | |
| 237 | 241 | return mdString.equals(response); |
| 238 | 242 | |
| 239 | 243 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | |
| 3 | +import org.slf4j.Logger; | |
| 4 | +import org.slf4j.LoggerFactory; | |
| 3 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | 6 | import org.springframework.data.redis.connection.Message; |
| 5 | 7 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| ... | ... | @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 17 | 19 | @Component |
| 18 | 20 | public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessageListener { |
| 19 | 21 | |
| 22 | + private Logger logger = LoggerFactory.getLogger(KeepaliveTimeoutListenerForPlatform.class); | |
| 23 | + | |
| 20 | 24 | @Autowired |
| 21 | 25 | private EventPublisher publisher; |
| 22 | 26 | |
| ... | ... | @@ -34,9 +38,9 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa |
| 34 | 38 | public void onMessage(Message message, byte[] pattern) { |
| 35 | 39 | // 获取失效的key |
| 36 | 40 | String expiredKey = message.toString(); |
| 37 | - System.out.println(expiredKey); | |
| 41 | + logger.info(expiredKey); | |
| 38 | 42 | if(!expiredKey.startsWith(VideoManagerConstants.PLATFORM_PREFIX)){ |
| 39 | - System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); | |
| 43 | + logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.PLATFORM_PREFIX+",忽略"); | |
| 40 | 44 | return; |
| 41 | 45 | } |
| 42 | 46 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 |
| ... | ... | @@ -45,7 +49,7 @@ public class KeepaliveTimeoutListenerForPlatform extends KeyExpirationEventMessa |
| 45 | 49 | |
| 46 | 50 | publisher.platformKeepaliveExpireEventPublish(platformGBId); |
| 47 | 51 | }else if (expiredKey.startsWith(VideoManagerConstants.PLATFORM_REGISTER_PREFIX)) { |
| 48 | - System.out.println("11111111111111"); | |
| 52 | + logger.info("11111111111111"); | |
| 49 | 53 | String platformGBId = expiredKey.substring(VideoManagerConstants.PLATFORM_REGISTER_PREFIX.length(),expiredKey.length()); |
| 50 | 54 | |
| 51 | 55 | publisher.platformNotRegisterEventPublish(platformGBId); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | |
| 3 | +import org.slf4j.Logger; | |
| 4 | +import org.slf4j.LoggerFactory; | |
| 3 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 4 | 6 | import org.springframework.data.redis.connection.Message; |
| 5 | 7 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| ... | ... | @@ -17,6 +19,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 17 | 19 | @Component |
| 18 | 20 | public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { |
| 19 | 21 | |
| 22 | + private Logger logger = LoggerFactory.getLogger(KeepliveTimeoutListener.class); | |
| 23 | + | |
| 20 | 24 | @Autowired |
| 21 | 25 | private EventPublisher publisher; |
| 22 | 26 | |
| ... | ... | @@ -34,7 +38,7 @@ public class KeepliveTimeoutListener extends KeyExpirationEventMessageListener { |
| 34 | 38 | // 获取失效的key |
| 35 | 39 | String expiredKey = message.toString(); |
| 36 | 40 | if(!expiredKey.startsWith(VideoManagerConstants.KEEPLIVEKEY_PREFIX)){ |
| 37 | - System.out.println("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略"); | |
| 41 | + logger.info("收到redis过期监听,但开头不是"+VideoManagerConstants.KEEPLIVEKEY_PREFIX+",忽略"); | |
| 38 | 42 | return; |
| 39 | 43 | } |
| 40 | 44 | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| ... | ... | @@ -280,7 +280,7 @@ public class SIPCommander implements ISIPCommander { |
| 280 | 280 | public boolean frontEndCmd(Device device, String channelId, int cmdCode, int parameter1, int parameter2, int combineCode2) { |
| 281 | 281 | try { |
| 282 | 282 | String cmdStr= frontEndCmdString(cmdCode, parameter1, parameter2, combineCode2); |
| 283 | - System.out.println("控制字符串:" + cmdStr); | |
| 283 | + logger.info("控制字符串:" + cmdStr); | |
| 284 | 284 | StringBuffer ptzXml = new StringBuffer(200); |
| 285 | 285 | ptzXml.append("<?xml version=\"1.0\" ?>\r\n"); |
| 286 | 286 | ptzXml.append("<Control>\r\n"); | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
| ... | ... | @@ -14,6 +14,8 @@ import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 14 | 14 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 15 | 15 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 16 | 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | +import org.slf4j.Logger; | |
| 18 | +import org.slf4j.LoggerFactory; | |
| 17 | 19 | |
| 18 | 20 | /** |
| 19 | 21 | * @Description:ACK请求处理器 |
| ... | ... | @@ -22,6 +24,9 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | 24 | */ |
| 23 | 25 | public class AckRequestProcessor extends SIPRequestAbstractProcessor { |
| 24 | 26 | |
| 27 | + | |
| 28 | + private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class); | |
| 29 | + | |
| 25 | 30 | private IRedisCatchStorage redisCatchStorage; |
| 26 | 31 | |
| 27 | 32 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| ... | ... | @@ -55,8 +60,8 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { |
| 55 | 60 | } |
| 56 | 61 | |
| 57 | 62 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 58 | - System.out.println(platformGbId); | |
| 59 | - System.out.println(channelId); | |
| 63 | + logger.info(platformGbId); | |
| 64 | + logger.info(channelId); | |
| 60 | 65 | Map<String, Object> param = new HashMap<>(); |
| 61 | 66 | param.put("vhost","__defaultVhost__"); |
| 62 | 67 | param.put("app",streamInfo.getApp()); |
| ... | ... | @@ -74,16 +79,16 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { |
| 74 | 79 | if (System.currentTimeMillis() - startTime < 30 * 1000) { |
| 75 | 80 | if (zlmrtpServerFactory.isStreamReady(streamInfo.getApp(), streamInfo.getStreamId())) { |
| 76 | 81 | rtpPushed = true; |
| 77 | - System.out.println("已获取设备推流,开始向上级推流"); | |
| 82 | + logger.info("已获取设备推流,开始向上级推流"); | |
| 78 | 83 | zlmrtpServerFactory.startSendRtpStream(param); |
| 79 | 84 | } else { |
| 80 | - System.out.println("等待设备推流......."); | |
| 85 | + logger.info("等待设备推流......."); | |
| 81 | 86 | Thread.sleep(1000); |
| 82 | 87 | continue; |
| 83 | 88 | } |
| 84 | 89 | } else { |
| 85 | 90 | rtpPushed = true; |
| 86 | - System.out.println("设备推流超时,终止向上级推流"); | |
| 91 | + logger.info("设备推流超时,终止向上级推流"); | |
| 87 | 92 | } |
| 88 | 93 | } catch (InterruptedException e) { |
| 89 | 94 | e.printStackTrace(); |
| ... | ... | @@ -95,7 +100,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { |
| 95 | 100 | // CSeq csReq = (CSeq) request.getHeader(CSeq.NAME); |
| 96 | 101 | // ackRequest = dialog.createAck(csReq.getSeqNumber()); |
| 97 | 102 | // dialog.sendAck(ackRequest); |
| 98 | - // System.out.println("send ack to callee:" + ackRequest.toString()); | |
| 103 | + // logger.info("send ack to callee:" + ackRequest.toString()); | |
| 99 | 104 | // } catch (SipException e) { |
| 100 | 105 | // e.printStackTrace(); |
| 101 | 106 | // } catch (InvalidArgumentException e) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/ByeRequestProcessor.java
| ... | ... | @@ -16,6 +16,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 16 | 16 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 17 | 17 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 18 | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | +import org.slf4j.Logger; | |
| 20 | +import org.slf4j.LoggerFactory; | |
| 19 | 21 | |
| 20 | 22 | import java.text.ParseException; |
| 21 | 23 | import java.util.HashMap; |
| ... | ... | @@ -28,6 +30,8 @@ import java.util.Map; |
| 28 | 30 | */ |
| 29 | 31 | public class ByeRequestProcessor extends SIPRequestAbstractProcessor { |
| 30 | 32 | |
| 33 | + private Logger logger = LoggerFactory.getLogger(ByeRequestProcessor.class); | |
| 34 | + | |
| 31 | 35 | private ISIPCommander cmder; |
| 32 | 36 | |
| 33 | 37 | private IRedisCatchStorage redisCatchStorage; |
| ... | ... | @@ -54,11 +58,11 @@ public class ByeRequestProcessor extends SIPRequestAbstractProcessor { |
| 54 | 58 | param.put("vhost","__defaultVhost__"); |
| 55 | 59 | param.put("app",sendRtpItem.getApp()); |
| 56 | 60 | param.put("stream",streamId); |
| 57 | - System.out.println("停止向上级推流:" + streamId); | |
| 61 | + logger.info("停止向上级推流:" + streamId); | |
| 58 | 62 | zlmrtpServerFactory.stopSendRtpStream(param); |
| 59 | 63 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); |
| 60 | 64 | if (zlmrtpServerFactory.totalReaderCount(sendRtpItem.getApp(), streamId) == 0) { |
| 61 | - System.out.println(streamId + "无其它观看者,通知设备停止推流"); | |
| 65 | + logger.info(streamId + "无其它观看者,通知设备停止推流"); | |
| 62 | 66 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId); |
| 63 | 67 | } |
| 64 | 68 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
| ... | ... | @@ -114,13 +114,13 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 114 | 114 | String cmd = XmlUtil.getText(rootElement, "CmdType"); |
| 115 | 115 | |
| 116 | 116 | if (MESSAGE_KEEP_ALIVE.equals(cmd)) { |
| 117 | - logger.info("接收到KeepAlive消息"); | |
| 117 | + logger.debug("接收到KeepAlive消息"); | |
| 118 | 118 | processMessageKeepAlive(evt); |
| 119 | 119 | } else if (MESSAGE_CONFIG_DOWNLOAD.equals(cmd)) { |
| 120 | - logger.info("接收到ConfigDownload消息"); | |
| 120 | + logger.debug("接收到ConfigDownload消息"); | |
| 121 | 121 | processMessageConfigDownload(evt); |
| 122 | 122 | } else if (MESSAGE_CATALOG.equals(cmd)) { |
| 123 | - logger.info("接收到Catalog消息"); | |
| 123 | + logger.debug("接收到Catalog消息"); | |
| 124 | 124 | processMessageCatalogList(evt); |
| 125 | 125 | } else if (MESSAGE_DEVICE_INFO.equals(cmd)) { |
| 126 | 126 | // DeviceInfo消息处理 |
| ... | ... | @@ -129,31 +129,31 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 129 | 129 | // DeviceStatus消息处理 |
| 130 | 130 | processMessageDeviceStatus(evt); |
| 131 | 131 | } else if (MESSAGE_DEVICE_CONTROL.equals(cmd)) { |
| 132 | - logger.info("接收到DeviceControl消息"); | |
| 132 | + logger.debug("接收到DeviceControl消息"); | |
| 133 | 133 | processMessageDeviceControl(evt); |
| 134 | 134 | } else if (MESSAGE_DEVICE_CONFIG.equals(cmd)) { |
| 135 | 135 | logger.info("接收到DeviceConfig消息"); |
| 136 | 136 | processMessageDeviceConfig(evt); |
| 137 | 137 | } else if (MESSAGE_ALARM.equals(cmd)) { |
| 138 | - logger.info("接收到Alarm消息"); | |
| 138 | + logger.debug("接收到Alarm消息"); | |
| 139 | 139 | processMessageAlarm(evt); |
| 140 | 140 | } else if (MESSAGE_RECORD_INFO.equals(cmd)) { |
| 141 | - logger.info("接收到RecordInfo消息"); | |
| 141 | + logger.debug("接收到RecordInfo消息"); | |
| 142 | 142 | processMessageRecordInfo(evt); |
| 143 | 143 | }else if (MESSAGE_MEDIA_STATUS.equals(cmd)) { |
| 144 | - logger.info("接收到MediaStatus消息"); | |
| 144 | + logger.debug("接收到MediaStatus消息"); | |
| 145 | 145 | processMessageMediaStatus(evt); |
| 146 | 146 | } else if (MESSAGE_MOBILE_POSITION.equals(cmd)) { |
| 147 | - logger.info("接收到MobilePosition消息"); | |
| 147 | + logger.debug("接收到MobilePosition消息"); | |
| 148 | 148 | processMessageMobilePosition(evt); |
| 149 | 149 | } else if (MESSAGE_PRESET_QUERY.equals(cmd)) { |
| 150 | - logger.info("接收到PresetQuery消息"); | |
| 150 | + logger.debug("接收到PresetQuery消息"); | |
| 151 | 151 | processMessagePresetQuery(evt); |
| 152 | 152 | } else if (MESSAGE_BROADCAST.equals(cmd)) { |
| 153 | 153 | // Broadcast消息处理 |
| 154 | 154 | processMessageBroadcast(evt); |
| 155 | 155 | } else { |
| 156 | - logger.info("接收到消息:" + cmd); | |
| 156 | + logger.debug("接收到消息:" + cmd); | |
| 157 | 157 | responseAck(evt); |
| 158 | 158 | } |
| 159 | 159 | } catch (DocumentException | SipException |InvalidArgumentException | ParseException e) { |
| ... | ... | @@ -467,7 +467,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { |
| 467 | 467 | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); |
| 468 | 468 | } |
| 469 | 469 | } else { |
| 470 | - logger.info("接收到DeviceInfo应答消息"); | |
| 470 | + logger.debug("接收到DeviceInfo应答消息"); | |
| 471 | 471 | Device device = storager.queryVideoDevice(deviceId); |
| 472 | 472 | if (device == null) { |
| 473 | 473 | return; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/OtherRequestProcessor.java
| ... | ... | @@ -3,6 +3,8 @@ package com.genersoft.iot.vmp.gb28181.transmit.request.impl; |
| 3 | 3 | import javax.sip.RequestEvent; |
| 4 | 4 | |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 6 | +import org.slf4j.Logger; | |
| 7 | +import org.slf4j.LoggerFactory; | |
| 6 | 8 | |
| 7 | 9 | /** |
| 8 | 10 | * @Description:暂不支持的消息请求处理器 |
| ... | ... | @@ -11,6 +13,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso |
| 11 | 13 | */ |
| 12 | 14 | public class OtherRequestProcessor extends SIPRequestAbstractProcessor { |
| 13 | 15 | |
| 16 | + private Logger logger = LoggerFactory.getLogger(OtherRequestProcessor.class); | |
| 17 | + | |
| 14 | 18 | /** |
| 15 | 19 | * <p>Title: process</p> |
| 16 | 20 | * <p>Description: </p> |
| ... | ... | @@ -21,7 +25,7 @@ public class OtherRequestProcessor extends SIPRequestAbstractProcessor { |
| 21 | 25 | */ |
| 22 | 26 | @Override |
| 23 | 27 | public void process(RequestEvent evt) { |
| 24 | - System.out.println("Unsupported the method: " + evt.getRequest().getMethod()); | |
| 28 | + logger.info("Unsupported the method: " + evt.getRequest().getMethod()); | |
| 25 | 29 | } |
| 26 | 30 | |
| 27 | 31 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/SubscribeRequestProcessor.java
| ... | ... | @@ -11,6 +11,8 @@ import javax.sip.message.Request; |
| 11 | 11 | import javax.sip.message.Response; |
| 12 | 12 | |
| 13 | 13 | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor; |
| 14 | +import org.slf4j.Logger; | |
| 15 | +import org.slf4j.LoggerFactory; | |
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | 18 | * @Description:SUBSCRIBE请求处理器 |
| ... | ... | @@ -19,6 +21,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso |
| 19 | 21 | */ |
| 20 | 22 | public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { |
| 21 | 23 | |
| 24 | + private Logger logger = LoggerFactory.getLogger(SubscribeRequestProcessor.class); | |
| 25 | + | |
| 22 | 26 | /** |
| 23 | 27 | * 处理SUBSCRIBE请求 |
| 24 | 28 | * |
| ... | ... | @@ -38,13 +42,13 @@ public class SubscribeRequestProcessor extends SIPRequestAbstractProcessor { |
| 38 | 42 | ExpiresHeader expireHeader = getHeaderFactory().createExpiresHeader(30); |
| 39 | 43 | response.setExpires(expireHeader); |
| 40 | 44 | } |
| 41 | - System.out.println("response : " + response.toString()); | |
| 45 | + logger.info("response : " + response.toString()); | |
| 42 | 46 | ServerTransaction transaction = getServerTransaction(evt); |
| 43 | 47 | if (transaction != null) { |
| 44 | 48 | transaction.sendResponse(response); |
| 45 | 49 | transaction.terminate(); |
| 46 | 50 | } else { |
| 47 | - System.out.println("processRequest serverTransactionId is null."); | |
| 51 | + logger.info("processRequest serverTransactionId is null."); | |
| 48 | 52 | } |
| 49 | 53 | |
| 50 | 54 | } catch (ParseException e) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/InviteResponseProcessor.java
| ... | ... | @@ -9,6 +9,8 @@ import javax.sip.message.Request; |
| 9 | 9 | import javax.sip.message.Response; |
| 10 | 10 | |
| 11 | 11 | import gov.nist.javax.sip.ResponseEventExt; |
| 12 | +import org.slf4j.Logger; | |
| 13 | +import org.slf4j.LoggerFactory; | |
| 12 | 14 | import org.springframework.stereotype.Component; |
| 13 | 15 | |
| 14 | 16 | import com.genersoft.iot.vmp.conf.SipConfig; |
| ... | ... | @@ -24,7 +26,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.response.ISIPResponseProcessor; |
| 24 | 26 | @Component |
| 25 | 27 | public class InviteResponseProcessor implements ISIPResponseProcessor { |
| 26 | 28 | |
| 27 | - // private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); | |
| 29 | + private final static Logger logger = LoggerFactory.getLogger(InviteResponseProcessor.class); | |
| 28 | 30 | |
| 29 | 31 | /** |
| 30 | 32 | * 处理invite响应 |
| ... | ... | @@ -51,7 +53,7 @@ public class InviteResponseProcessor implements ISIPResponseProcessor { |
| 51 | 53 | requestURI.setHost(event.getRemoteIpAddress()); |
| 52 | 54 | requestURI.setPort(event.getRemotePort()); |
| 53 | 55 | reqAck.setRequestURI(requestURI); |
| 54 | - System.out.println("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); | |
| 56 | + logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); | |
| 55 | 57 | dialog.sendAck(reqAck); |
| 56 | 58 | } |
| 57 | 59 | } catch (InvalidArgumentException | SipException e) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/utils/NumericUtil.java
| 1 | 1 | package com.genersoft.iot.vmp.gb28181.utils; |
| 2 | 2 | |
| 3 | +import org.slf4j.Logger; | |
| 4 | +import org.slf4j.LoggerFactory; | |
| 5 | + | |
| 3 | 6 | /** |
| 4 | 7 | * 数值格式判断和处理 |
| 5 | 8 | * @author lawrencehj |
| ... | ... | @@ -7,6 +10,8 @@ package com.genersoft.iot.vmp.gb28181.utils; |
| 7 | 10 | */ |
| 8 | 11 | public class NumericUtil { |
| 9 | 12 | |
| 13 | + private static Logger logger = LoggerFactory.getLogger(NumericUtil.class); | |
| 14 | + | |
| 10 | 15 | /** |
| 11 | 16 | * 判断是否Double格式 |
| 12 | 17 | * @param str |
| ... | ... | @@ -14,11 +19,11 @@ public class NumericUtil { |
| 14 | 19 | */ |
| 15 | 20 | public static boolean isDouble(String str) { |
| 16 | 21 | try { |
| 17 | - Double num2 = Double.valueOf(str); | |
| 18 | - System.out.println(num2 + " is a valid numeric string!"); | |
| 22 | + Double num2 = Double.valueOf(str); | |
| 23 | + logger.debug(num2 + " is a valid numeric string!"); | |
| 19 | 24 | return true; |
| 20 | 25 | } catch (Exception e) { |
| 21 | - System.out.println(str + " is an invalid numeric string!"); | |
| 26 | + logger.debug(str + " is an invalid numeric string!"); | |
| 22 | 27 | return false; |
| 23 | 28 | } |
| 24 | 29 | } |
| ... | ... | @@ -31,10 +36,10 @@ public class NumericUtil { |
| 31 | 36 | public static boolean isInteger(String str) { |
| 32 | 37 | try { |
| 33 | 38 | int num2 = Integer.valueOf(str); |
| 34 | - System.out.println(num2 + " is an integer!"); | |
| 39 | + logger.debug(num2 + " is an integer!"); | |
| 35 | 40 | return true; |
| 36 | 41 | } catch (Exception e) { |
| 37 | - System.out.println(str + " is not an integer!"); | |
| 42 | + logger.debug(str + " is not an integer!"); | |
| 38 | 43 | return false; |
| 39 | 44 | } |
| 40 | 45 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| ... | ... | @@ -251,7 +251,7 @@ public class ZLMHttpHookListener { |
| 251 | 251 | JSONArray tracks = json.getJSONArray("tracks"); |
| 252 | 252 | boolean regist = json.getBoolean("regist"); |
| 253 | 253 | if (tracks != null) { |
| 254 | - System.out.println("on_stream_changed->>" + schema); | |
| 254 | + logger.info("[stream: " + streamId + "]on_stream_changed->>" + schema); | |
| 255 | 255 | } |
| 256 | 256 | if ("rtmp".equals(schema)){ |
| 257 | 257 | if ("rtp".equals(app) && !regist ) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| ... | ... | @@ -71,7 +71,6 @@ public class ZLMMediaListManager { |
| 71 | 71 | jsonObject.put("app", streamPushItem.getApp()); |
| 72 | 72 | jsonObject.put("stream", streamPushItem.getStream()); |
| 73 | 73 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_play,jsonObject,(response)->{ |
| 74 | - System.out.println(1222211111); | |
| 75 | 74 | updateMedia(response.getString("app"), response.getString("stream")); |
| 76 | 75 | }); |
| 77 | 76 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRESTfulUtils.java
| ... | ... | @@ -131,8 +131,8 @@ public class ZLMRESTfulUtils { |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public JSONObject addFFmpegSource(String src_url, String dst_url, String timeout_ms){ |
| 134 | - System.out.println(src_url); | |
| 135 | - System.out.println(dst_url); | |
| 134 | + logger.info(src_url); | |
| 135 | + logger.info(dst_url); | |
| 136 | 136 | Map<String, Object> param = new HashMap<>(); |
| 137 | 137 | param.put("src_url", src_url); |
| 138 | 138 | param.put("dst_url", dst_url); | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| ... | ... | @@ -189,7 +189,7 @@ public class ZLMRTPServerFactory { |
| 189 | 189 | public Boolean startSendRtpStream(Map<String, Object>param) { |
| 190 | 190 | Boolean result = false; |
| 191 | 191 | JSONObject jsonObject = zlmresTfulUtils.startSendRtp(param); |
| 192 | - System.out.println(jsonObject); | |
| 192 | + logger.info(jsonObject.toJSONString()); | |
| 193 | 193 | if (jsonObject == null) { |
| 194 | 194 | logger.error("RTP推流失败: 请检查ZLM服务"); |
| 195 | 195 | } else if (jsonObject.getInteger("code") == 0) { |
| ... | ... | @@ -233,7 +233,7 @@ public class ZLMRTPServerFactory { |
| 233 | 233 | public Boolean stopSendRtpStream(Map<String, Object>param) { |
| 234 | 234 | Boolean result = false; |
| 235 | 235 | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(param); |
| 236 | - System.out.println(jsonObject); | |
| 236 | + logger.info(jsonObject.toJSONString()); | |
| 237 | 237 | if (jsonObject == null) { |
| 238 | 238 | logger.error("停止RTP推流失败: 请检查ZLM服务"); |
| 239 | 239 | } else if (jsonObject.getInteger("code") == 0) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
| ... | ... | @@ -154,11 +154,11 @@ public class ZLMRunner implements CommandLineRunner { |
| 154 | 154 | * zlm 连接成功或者zlm重启后 |
| 155 | 155 | */ |
| 156 | 156 | private void zLmRunning(MediaServerConfig mediaServerConfig){ |
| 157 | - logger.info("zlm接入成功..."); | |
| 157 | + logger.info( "[ id: " + mediaServerConfig.getGeneralMediaServerId() + "] zlm接入成功..."); | |
| 158 | 158 | if (autoConfig) saveZLMConfig(); |
| 159 | 159 | MediaServerConfig mediaInfo = redisCatchStorage.getMediaInfo(); |
| 160 | 160 | if (mediaInfo != null && System.currentTimeMillis() - mediaInfo.getUpdateTime() < 50){ |
| 161 | - logger.info("zlm刚刚更新,忽略这次更新"); | |
| 161 | + logger.info("[ id: " + mediaServerConfig.getGeneralMediaServerId() + "]zlm刚刚更新,忽略这次更新"); | |
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | 164 | mediaServerConfig.setLocalIP(mediaIp); | ... | ... |
src/main/java/com/genersoft/iot/vmp/onvif/impl/ONVIFServerIMpl.java
| ... | ... | @@ -43,7 +43,7 @@ public class ONVIFServerIMpl implements IONVIFServer { |
| 43 | 43 | public void onDevicesFound(List<Device> devices) { |
| 44 | 44 | if (devices == null || devices.size() == 0) return; |
| 45 | 45 | for (Device device : devices){ |
| 46 | - System.out.println(device.getHostName()); | |
| 46 | + logger.info(device.getHostName()); | |
| 47 | 47 | deviceMap.put(device.getHostName(), device); |
| 48 | 48 | } |
| 49 | 49 | } |
| ... | ... | @@ -53,7 +53,7 @@ public class ONVIFServerIMpl implements IONVIFServer { |
| 53 | 53 | public void onDiscoveryFinished() { |
| 54 | 54 | ArrayList<String> result = new ArrayList<>(); |
| 55 | 55 | for (Device device : deviceMap.values()) { |
| 56 | - System.out.println(device.getHostName()); | |
| 56 | + logger.info(device.getHostName()); | |
| 57 | 57 | result.add(device.getHostName()); |
| 58 | 58 | } |
| 59 | 59 | callBack.run(0, result); |
| ... | ... | @@ -71,14 +71,14 @@ public class ONVIFServerIMpl implements IONVIFServer { |
| 71 | 71 | |
| 72 | 72 | @Override |
| 73 | 73 | public void onResponse(OnvifDevice onvifDevice, OnvifResponse response) { |
| 74 | - System.out.println("[RESPONSE] " + onvifDevice.getHostName() | |
| 74 | + logger.info("[RESPONSE] " + onvifDevice.getHostName() | |
| 75 | 75 | + "======" + response.getErrorCode() |
| 76 | 76 | + "======" + response.getErrorMessage()); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | @Override |
| 80 | 80 | public void onError(OnvifDevice onvifDevice, int errorCode, String errorMessage) { |
| 81 | - System.out.println("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); | |
| 81 | + logger.info("[ERROR] " + onvifDevice.getHostName() + "======" + errorCode + "=======" + errorMessage); | |
| 82 | 82 | callBack.run(errorCode, errorMessage); |
| 83 | 83 | } |
| 84 | 84 | }); |
| ... | ... | @@ -91,8 +91,8 @@ public class ONVIFServerIMpl implements IONVIFServer { |
| 91 | 91 | @Override |
| 92 | 92 | public void onMediaProfilesReceived(OnvifDevice device, List<OnvifMediaProfile> mediaProfiles) { |
| 93 | 93 | for (OnvifMediaProfile mediaProfile : mediaProfiles) { |
| 94 | - System.out.println(mediaProfile.getName()); | |
| 95 | - System.out.println(mediaProfile.getToken()); | |
| 94 | + logger.info(mediaProfile.getName()); | |
| 95 | + logger.info(mediaProfile.getToken()); | |
| 96 | 96 | if (mediaProfile.getName().equals("mainStream")) { |
| 97 | 97 | onvifManager.getMediaStreamURI(device, mediaProfile, (OnvifDevice onvifDevice, |
| 98 | 98 | OnvifMediaProfile profile, String uri) -> { | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| ... | ... | @@ -12,6 +12,8 @@ import com.genersoft.iot.vmp.storager.dao.*; |
| 12 | 12 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 13 | 13 | import com.github.pagehelper.PageHelper; |
| 14 | 14 | import com.github.pagehelper.PageInfo; |
| 15 | +import org.slf4j.Logger; | |
| 16 | +import org.slf4j.LoggerFactory; | |
| 15 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | 18 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 17 | 19 | import org.springframework.stereotype.Component; |
| ... | ... | @@ -29,6 +31,9 @@ import org.springframework.transaction.annotation.Transactional; |
| 29 | 31 | @SuppressWarnings("rawtypes") |
| 30 | 32 | @Component |
| 31 | 33 | public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 34 | + | |
| 35 | + private Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); | |
| 36 | + | |
| 32 | 37 | @Autowired |
| 33 | 38 | DataSourceTransactionManager dataSourceTransactionManager; |
| 34 | 39 | |
| ... | ... | @@ -232,7 +237,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 232 | 237 | return false; |
| 233 | 238 | } |
| 234 | 239 | device.setOnline(1); |
| 235 | - System.out.println("更新设备在线"); | |
| 240 | + logger.info("更新设备在线: " + deviceId); | |
| 236 | 241 | return deviceMapper.update(device) > 0; |
| 237 | 242 | } |
| 238 | 243 | |
| ... | ... | @@ -244,7 +249,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 244 | 249 | */ |
| 245 | 250 | @Override |
| 246 | 251 | public synchronized boolean outline(String deviceId) { |
| 247 | - System.out.println("更新设备离线: " + deviceId); | |
| 252 | + logger.info("更新设备离线: " + deviceId); | |
| 248 | 253 | Device device = deviceMapper.getDeviceByDeviceId(deviceId); |
| 249 | 254 | if (device == null) return false; |
| 250 | 255 | device.setOnline(0); |
| ... | ... | @@ -540,7 +545,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { |
| 540 | 545 | @Override |
| 541 | 546 | public void updateMediaList(List<StreamPushItem> streamPushItems) { |
| 542 | 547 | if (streamPushItems == null || streamPushItems.size() == 0) return; |
| 543 | - System.out.printf("updateMediaList: " + streamPushItems.size()); | |
| 548 | + logger.info("updateMediaList: " + streamPushItems.size()); | |
| 544 | 549 | streamPushMapper.addAll(streamPushItems); |
| 545 | 550 | // TODO 待优化 |
| 546 | 551 | for (int i = 0; i < streamPushItems.size(); i++) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/utils/GpsUtil.java
| ... | ... | @@ -7,9 +7,16 @@ import java.net.Socket; |
| 7 | 7 | import java.util.Base64; |
| 8 | 8 | |
| 9 | 9 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 10 | +import org.slf4j.Logger; | |
| 11 | +import org.slf4j.LoggerFactory; | |
| 10 | 12 | |
| 11 | 13 | public class GpsUtil { |
| 14 | + | |
| 15 | + private static Logger logger = LoggerFactory.getLogger(GpsUtil.class); | |
| 16 | + | |
| 12 | 17 | public static BaiduPoint Wgs84ToBd09(String xx, String yy) { |
| 18 | + | |
| 19 | + | |
| 13 | 20 | try { |
| 14 | 21 | Socket s = new Socket("api.map.baidu.com", 80); |
| 15 | 22 | BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(), "UTF-8")); |
| ... | ... | @@ -26,7 +33,7 @@ public class GpsUtil { |
| 26 | 33 | String json = ""; |
| 27 | 34 | String tmp = ""; |
| 28 | 35 | while ((tmp = br.readLine()) != null) { |
| 29 | - // System.out.println(tmp); | |
| 36 | + // logger.info(tmp); | |
| 30 | 37 | json += tmp; |
| 31 | 38 | } |
| 32 | 39 | |
| ... | ... | @@ -44,7 +51,7 @@ public class GpsUtil { |
| 44 | 51 | return bdPoint; |
| 45 | 52 | //return (new String(decode(x)) + "," + new String(decode(y))); |
| 46 | 53 | } else { |
| 47 | - System.out.println("gps坐标无效!!"); | |
| 54 | + logger.info("gps坐标无效!!"); | |
| 48 | 55 | } |
| 49 | 56 | out.close(); |
| 50 | 57 | br.close(); | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| ... | ... | @@ -167,7 +167,7 @@ public class PlayController { |
| 167 | 167 | streamId ); |
| 168 | 168 | String srcUrl = String.format("rtsp://%s:%s/rtp/%s", "127.0.0.1", mediaInfo.getRtspPort(), streamId); |
| 169 | 169 | JSONObject jsonObject = zlmresTfulUtils.addFFmpegSource(srcUrl, dstUrl, "1000000"); |
| 170 | - System.out.println(jsonObject); | |
| 170 | + logger.info(jsonObject.toJSONString()); | |
| 171 | 171 | JSONObject result = new JSONObject(); |
| 172 | 172 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| 173 | 173 | result.put("code", 0); |
| ... | ... | @@ -198,7 +198,7 @@ public class PlayController { |
| 198 | 198 | public ResponseEntity<String> playConvertStop(@PathVariable String key) { |
| 199 | 199 | |
| 200 | 200 | JSONObject jsonObject = zlmresTfulUtils.delFFmpegSource(key); |
| 201 | - System.out.println(jsonObject); | |
| 201 | + logger.info(jsonObject.toJSONString()); | |
| 202 | 202 | JSONObject result = new JSONObject(); |
| 203 | 203 | if (jsonObject != null && jsonObject.getInteger("code") == 0) { |
| 204 | 204 | result.put("code", 0); | ... | ... |