diff options
Diffstat (limited to 'juick-ws/src/main/java/com/juick/ws/XMPPConnection.java')
-rw-r--r-- | juick-ws/src/main/java/com/juick/ws/XMPPConnection.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java index b75ca998..f535d123 100644 --- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java +++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java @@ -68,7 +68,8 @@ public class XMPPConnection implements AutoCloseable { Message msg = e.getMessage(); com.juick.Message jmsg = msg.getExtension(com.juick.Message.class); if (jmsg != null) { - logger.info("got msg: " + ms.writeValueAsString(jmsg)); + if (logger.isInfoEnabled()) // prevent writeValueAsString execution if log is disabled + logger.info("got msg: {}", ms.writeValueAsString(jmsg)); if (jmsg.getMid() == 0) { int uid_to = NumberUtils.toInt(msg.getTo().getLocal(), 0); if (uid_to > 0) { @@ -106,7 +107,7 @@ public class XMPPConnection implements AutoCloseable { synchronized (wsHandler.getClients()) { wsHandler.getClients().stream().filter(c -> !c.legacy && c.visitor.getUid() == uid_to).forEach(c -> { try { - logger.info("sending pm to " + c.visitor.getUid()); + logger.info("sending pm to {}", c.visitor.getUid()); c.session.sendMessage(new TextMessage(json)); } catch (IOException e) { logger.warn("ws error", e); @@ -125,7 +126,7 @@ public class XMPPConnection implements AutoCloseable { || (!c.legacy && uids.contains(c.visitor.getUid()))) // subscriptions .forEach(c -> { try { - logger.info("sending message to " + c.visitor.getUid()); + logger.info("sending message to {}", c.visitor.getUid()); c.session.sendMessage(new TextMessage(json)); } catch (IOException e) { logger.warn("ws error", e); @@ -135,7 +136,7 @@ public class XMPPConnection implements AutoCloseable { c.legacy && c.allMessages) // legacy all posts .forEach(c -> { try { - logger.info("sending message to legacy client " + c.visitor.getUid()); + logger.info("sending message to legacy client {}", c.visitor.getUid()); c.session.sendMessage(new TextMessage(json)); } catch (IOException e) { logger.warn("ws error", e); @@ -155,7 +156,7 @@ public class XMPPConnection implements AutoCloseable { || (!c.legacy && threadUsers.contains(c.visitor.getUid()))) // subscriptions .forEach(c -> { try { - logger.info("sending reply to " + c.visitor.getUid()); + logger.info("sending reply to {}", c.visitor.getUid()); c.session.sendMessage(new TextMessage(json)); } catch (IOException e) { logger.warn("ws error", e); @@ -165,7 +166,7 @@ public class XMPPConnection implements AutoCloseable { (c.legacy && c.allReplies) || (c.legacy && c.MID == jmsg.getMid())) // legacy replies .forEach(c -> { try { - logger.info("sending reply to legacy client " + c.visitor.getUid()); + logger.info("sending reply to legacy client {}", c.visitor.getUid()); c.session.sendMessage(new TextMessage(json)); } catch (IOException e) { logger.warn("ws error", e); |