使用Slf4j注解打印日志
This commit is contained in:
@@ -9,10 +9,8 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||
import com.genersoft.iot.vmp.service.IDeviceService;
|
||||
import com.genersoft.iot.vmp.service.IPlatformService;
|
||||
import com.genersoft.iot.vmp.service.impl.PlatformServiceImpl;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.core.annotation.Order;
|
||||
@@ -30,6 +28,7 @@ import java.util.Map;
|
||||
* 系统启动时控制设备
|
||||
* @author lin
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Order(value=14)
|
||||
public class SipRunner implements CommandLineRunner {
|
||||
@@ -52,8 +51,6 @@ public class SipRunner implements CommandLineRunner {
|
||||
@Autowired
|
||||
private ISIPCommanderForPlatform commanderForPlatform;
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(PlatformServiceImpl.class);
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
List<Device> deviceList = deviceService.getAllOnlineDevice();
|
||||
@@ -103,7 +100,7 @@ public class SipRunner implements CommandLineRunner {
|
||||
try {
|
||||
commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
|
||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||
logger.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.sip.DialogState;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
@@ -20,8 +19,8 @@ import java.text.ParseException;
|
||||
* 目录订阅任务
|
||||
* @author lin
|
||||
*/
|
||||
@Slf4j
|
||||
public class CatalogSubscribeTask implements ISubscribeTask {
|
||||
private final Logger logger = LoggerFactory.getLogger(CatalogSubscribeTask.class);
|
||||
private final Device device;
|
||||
private final ISIPCommander sipCommander;
|
||||
private SIPRequest request;
|
||||
@@ -47,22 +46,22 @@ public class CatalogSubscribeTask implements ISubscribeTask {
|
||||
sipRequest = sipCommander.catalogSubscribe(device, request, eventResult -> {
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
// 成功
|
||||
logger.info("[目录订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[目录订阅]成功: {}", device.getDeviceId());
|
||||
ToHeader toHeader = (ToHeader)event.getResponse().getHeader(ToHeader.NAME);
|
||||
try {
|
||||
this.request.getToHeader().setTag(toHeader.getTag());
|
||||
} catch (ParseException e) {
|
||||
logger.info("[目录订阅]成功: 但为request设置ToTag失败");
|
||||
log.info("[目录订阅]成功: 但为request设置ToTag失败");
|
||||
this.request = null;
|
||||
}
|
||||
},eventResult -> {
|
||||
this.request = null;
|
||||
// 失败
|
||||
logger.warn("[目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
log.warn("[目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
dynamicTask.startDelay(taskKey, CatalogSubscribeTask.this, 2000);
|
||||
});
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 目录订阅: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 目录订阅: {}", e.getMessage());
|
||||
|
||||
}
|
||||
if (sipRequest != null) {
|
||||
@@ -79,7 +78,7 @@ public class CatalogSubscribeTask implements ISubscribeTask {
|
||||
* COMPLETED-> Completed Dialog状态-已完成
|
||||
* TERMINATED-> Terminated Dialog状态-终止
|
||||
*/
|
||||
logger.info("取消目录订阅时dialog状态为{}", DialogState.CONFIRMED);
|
||||
log.info("取消目录订阅时dialog状态为{}", DialogState.CONFIRMED);
|
||||
if (dynamicTask.get(taskKey) != null) {
|
||||
dynamicTask.stop(taskKey);
|
||||
}
|
||||
@@ -89,20 +88,20 @@ public class CatalogSubscribeTask implements ISubscribeTask {
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
if (event.getResponse().getRawContent() != null) {
|
||||
// 成功
|
||||
logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
}else {
|
||||
// 成功
|
||||
logger.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[取消目录订阅]成功: {}", device.getDeviceId());
|
||||
}
|
||||
if (callback != null) {
|
||||
callback.run(event.getResponse().getRawContent() != null);
|
||||
}
|
||||
},eventResult -> {
|
||||
// 失败
|
||||
logger.warn("[取消目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
log.warn("[取消目录订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
});
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 取消目录订阅: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 取消目录订阅: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.task.ISubscribeTask;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.ResponseEvent;
|
||||
@@ -19,8 +18,8 @@ import java.text.ParseException;
|
||||
* 移动位置订阅的定时更新
|
||||
* @author lin
|
||||
*/
|
||||
@Slf4j
|
||||
public class MobilePositionSubscribeTask implements ISubscribeTask {
|
||||
private final Logger logger = LoggerFactory.getLogger(MobilePositionSubscribeTask.class);
|
||||
private final Device device;
|
||||
private final ISIPCommander sipCommander;
|
||||
|
||||
@@ -43,23 +42,23 @@ public class MobilePositionSubscribeTask implements ISubscribeTask {
|
||||
try {
|
||||
sipRequest = sipCommander.mobilePositionSubscribe(device, request, eventResult -> {
|
||||
// 成功
|
||||
logger.info("[移动位置订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[移动位置订阅]成功: {}", device.getDeviceId());
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
ToHeader toHeader = (ToHeader)event.getResponse().getHeader(ToHeader.NAME);
|
||||
try {
|
||||
this.request.getToHeader().setTag(toHeader.getTag());
|
||||
} catch (ParseException e) {
|
||||
logger.info("[移动位置订阅]成功: 为request设置ToTag失败");
|
||||
log.info("[移动位置订阅]成功: 为request设置ToTag失败");
|
||||
this.request = null;
|
||||
}
|
||||
},eventResult -> {
|
||||
this.request = null;
|
||||
// 失败
|
||||
logger.warn("[移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
log.warn("[移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
dynamicTask.startDelay(taskKey, MobilePositionSubscribeTask.this, 2000);
|
||||
});
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 移动位置订阅: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 移动位置订阅: {}", e.getMessage());
|
||||
}
|
||||
if (sipRequest != null) {
|
||||
this.request = sipRequest;
|
||||
@@ -85,20 +84,20 @@ public class MobilePositionSubscribeTask implements ISubscribeTask {
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
if (event.getResponse().getRawContent() != null) {
|
||||
// 成功
|
||||
logger.info("[取消移动位置订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[取消移动位置订阅]成功: {}", device.getDeviceId());
|
||||
}else {
|
||||
// 成功
|
||||
logger.info("[取消移动位置订阅]成功: {}", device.getDeviceId());
|
||||
log.info("[取消移动位置订阅]成功: {}", device.getDeviceId());
|
||||
}
|
||||
if (callback != null) {
|
||||
callback.run(event.getResponse().getRawContent() != null);
|
||||
}
|
||||
},eventResult -> {
|
||||
// 失败
|
||||
logger.warn("[取消移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
log.warn("[取消移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg);
|
||||
});
|
||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||
logger.error("[命令发送失败] 取消移动位置订阅: {}", e.getMessage());
|
||||
log.error("[命令发送失败] 取消移动位置订阅: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user