From 01a5dfa202abf4176bcd8768b31689855bd4a1f7 Mon Sep 17 00:00:00 2001 From: andsel Date: Wed, 20 Nov 2024 14:28:50 +0100 Subject: [PATCH] [DEBUG] Enable message log for client to investigate problem in CI --- .../src/main/java/io/moquette/broker/NewNettyAcceptor.java | 2 +- .../java/io/moquette/integration/mqtt5/FlowControlTest.java | 2 ++ broker/src/test/java/io/moquette/testclient/Client.java | 2 ++ broker/src/test/resources/log4j.properties | 6 +++--- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/broker/src/main/java/io/moquette/broker/NewNettyAcceptor.java b/broker/src/main/java/io/moquette/broker/NewNettyAcceptor.java index dbf6b4226..6bf7b2c37 100644 --- a/broker/src/main/java/io/moquette/broker/NewNettyAcceptor.java +++ b/broker/src/main/java/io/moquette/broker/NewNettyAcceptor.java @@ -297,7 +297,7 @@ private void configureMQTTPipeline(ChannelPipeline pipeline, MoquetteIdleTimeout pipeline.addLast("decoder", new MqttDecoder(maxBytesInMessage)); pipeline.addLast("encoder", MqttEncoder.INSTANCE); pipeline.addLast("metrics", new MessageMetricsHandler(metricsCollector)); - pipeline.addLast("messageLogger", new MQTTMessageLogger()); +// pipeline.addLast("messageLogger", new MQTTMessageLogger()); if (metrics.isPresent()) { pipeline.addLast("wizardMetrics", metrics.get()); } diff --git a/broker/src/test/java/io/moquette/integration/mqtt5/FlowControlTest.java b/broker/src/test/java/io/moquette/integration/mqtt5/FlowControlTest.java index 7df84f543..4f819781b 100644 --- a/broker/src/test/java/io/moquette/integration/mqtt5/FlowControlTest.java +++ b/broker/src/test/java/io/moquette/integration/mqtt5/FlowControlTest.java @@ -159,6 +159,8 @@ public void givenClientThatReconnectWithSmallerReceiveMaximumThenForwardCorrectl // subscribe with an identifier MqttMessage received = lowLevelClient.subscribeWithIdentifier("temperature/living", MqttQoS.AT_LEAST_ONCE, 123); + + System.out.println("\n\n\n\n"); verifyOfType(received, MqttMessageType.SUBACK); //lowlevel client doesn't ACK any pub, so the in flight window fills up diff --git a/broker/src/test/java/io/moquette/testclient/Client.java b/broker/src/test/java/io/moquette/testclient/Client.java index b383eff9e..9202211d5 100644 --- a/broker/src/test/java/io/moquette/testclient/Client.java +++ b/broker/src/test/java/io/moquette/testclient/Client.java @@ -16,6 +16,7 @@ package io.moquette.testclient; import io.moquette.BrokerConstants; +import io.moquette.broker.metrics.MQTTMessageLogger; import io.netty.bootstrap.Bootstrap; import io.netty.channel.*; import io.netty.channel.nio.NioEventLoopGroup; @@ -83,6 +84,7 @@ public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast("rawcli_decoder", new MqttDecoder()); pipeline.addLast("rawcli_encoder", MqttEncoder.INSTANCE); + pipeline.addLast("messageLogger", new MQTTMessageLogger()); pipeline.addLast("rawcli_handler", handler); } }); diff --git a/broker/src/test/resources/log4j.properties b/broker/src/test/resources/log4j.properties index 62ba32f58..205e2268b 100644 --- a/broker/src/test/resources/log4j.properties +++ b/broker/src/test/resources/log4j.properties @@ -15,7 +15,7 @@ log4j.logger.BufferManagement=TRACE log4j.appender.stdout=org.apache.log4j.ConsoleAppender # Enable TRACE to see the output of ByteBuf tracking #log4j.appender.stdout.Threshold=TRACE -log4j.appender.stdout.Threshold=INFO +log4j.appender.stdout.Threshold=DEBUG # for debug trace log4j.appender.stdout.layout=org.apache.log4j.PatternLayout @@ -37,8 +37,8 @@ log4j.appender.stdout.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss,SSS} [%t]% # Message Logger Configuration # ##################################### log4j.appender.messagelog=org.apache.log4j.ConsoleAppender -log4j.appender.messagelog.Threshold=WARN +log4j.appender.messagelog.Threshold=DEBUG log4j.appender.messagelog.layout=org.apache.log4j.PatternLayout log4j.appender.messagelog.layout.ConversionPattern=%d{HH:mm:ss,SSS} [%t] %-5p %c{1} %L %x - %m%n -log4j.category.io.moquette.broker.metrics.MQTTMessageLogger=WARN, messagelog +log4j.category.io.moquette.broker.metrics.MQTTMessageLogger=DEBUG, messagelog