Minor on logging, removed ugly if(isDebugEnabled()) for debug logging, kept only when the toString generation could potentially take long, and trasformed in tracing logs. Moved Error to Warn log level

This commit is contained in:
andsel
2017-01-18 23:28:11 +01:00
parent e295fcf9f2
commit 716c9ac0a0
17 changed files with 72 additions and 144 deletions
@@ -225,13 +225,11 @@ public class Server {
* */
public void internalPublish(PublishMessage msg) {
if (!m_initialized) {
LOG.error("The server is not started. The message cannot be published. MqttClientId = {}, messageId = {}.",
msg.getClientId(), msg.getMessageID());
throw new IllegalStateException("Can't publish on a server is not yet started");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Publishing message. MqttClientId = {}, messageId = {}.", msg.getClientId(), msg.getMessageID());
LOG.error("The server is not started. The message cannot be published. MqttClientId = {}, messageId = {}.",
msg.getClientId(), msg.getMessageID());
throw new IllegalStateException("Can't publish on a server is not yet started");
}
LOG.debug("Publishing message. MqttClientId = {}, messageId = {}.", msg.getClientId(), msg.getMessageID());
m_processor.internalPublish(msg);
}
@@ -46,9 +46,7 @@ public class NettyMQTTHandler extends ChannelInboundHandlerAdapter {
public void channelRead(ChannelHandlerContext ctx, Object message) {
AbstractMessage msg = (AbstractMessage) message;
String messageType = Utils.msgType2String(msg.getMessageType());
if (LOG.isDebugEnabled()) {
LOG.debug("Processing MQTT message. MessageType = {}.", messageType);
}
LOG.debug("Processing MQTT message. MessageType = {}.", messageType);
try {
switch (msg.getMessageType()) {
case CONNECT: