mqtt handler shows short logs on info level and stacktrace on debug level. DeviceId will also print in the logs
This commit is contained in:
		
							parent
							
								
									0027d6de96
								
							
						
					
					
						commit
						25bb031846
					
				@ -885,7 +885,13 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
 | 
			
		||||
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
 | 
			
		||||
        if (cause instanceof IOException) {
 | 
			
		||||
            if (log.isDebugEnabled()) {
 | 
			
		||||
                log.debug("[{}][{}] IOException: {}", sessionId,
 | 
			
		||||
                log.debug("[{}][{}][{}] IOException: {}", sessionId,
 | 
			
		||||
                        Optional.ofNullable(this.deviceSessionCtx.getDeviceInfo()).map(TransportDeviceInfo::getDeviceId).orElse(null),
 | 
			
		||||
                        Optional.ofNullable(this.deviceSessionCtx.getDeviceInfo()).map(TransportDeviceInfo::getDeviceName).orElse(""),
 | 
			
		||||
                        cause);
 | 
			
		||||
            } else if (log.isInfoEnabled()) {
 | 
			
		||||
                log.info("[{}][{}][{}] IOException: {}", sessionId,
 | 
			
		||||
                        Optional.ofNullable(this.deviceSessionCtx.getDeviceInfo()).map(TransportDeviceInfo::getDeviceId).orElse(null),
 | 
			
		||||
                        Optional.ofNullable(this.deviceSessionCtx.getDeviceInfo()).map(TransportDeviceInfo::getDeviceName).orElse(""),
 | 
			
		||||
                        cause.getMessage());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user