Merge pull request #7519 from smatvienko-tb/mqtt-transport-log-shorter-on-io-exception
[3.4.2] MQTT transport: Make log shorter on IOException
This commit is contained in:
commit
13996b6ce8
@ -883,7 +883,22 @@ public class MqttTransportHandler extends ChannelInboundHandlerAdapter implement
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
log.error("[{}] Unexpected Exception", sessionId, cause);
|
||||
if (cause instanceof IOException) {
|
||||
if (log.isDebugEnabled()) {
|
||||
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());
|
||||
}
|
||||
} else {
|
||||
log.error("[{}] Unexpected Exception", sessionId, cause);
|
||||
}
|
||||
|
||||
ctx.close();
|
||||
if (cause instanceof OutOfMemoryError) {
|
||||
log.error("Received critical error. Going to shutdown the service.");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user