Skip to content

Commit

Permalink
[DEBUG] Enable message log for client to investigate problem in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andsel committed Nov 20, 2024
1 parent b26f940 commit 01a5dfa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions broker/src/test/java/io/moquette/testclient/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
});
Expand Down
6 changes: 3 additions & 3 deletions broker/src/test/resources/log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 01a5dfa

Please sign in to comment.