From e25ec6f291c3b04f6bf492ad5f803bbc379d27eb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 21 Dec 2023 17:56:38 +0300 Subject: Log XMPP traffic at trace level --- src/main/java/com/juick/XMPPManager.java | 10 ++++++---- .../java/rocks/xmpp/core/session/debug/LogbackDebugger.java | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/juick/XMPPManager.java b/src/main/java/com/juick/XMPPManager.java index d4daf9a4..0c5cb2f4 100644 --- a/src/main/java/com/juick/XMPPManager.java +++ b/src/main/java/com/juick/XMPPManager.java @@ -99,11 +99,13 @@ public class XMPPManager implements NotificationListener { this.messagesService = messagesService; this.userService = userService; logger.info("xmpp component start connecting to {}", componentPort); - XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() + var configurationBuilder = XmppSessionConfiguration.builder() .extensions(Extension.of(com.juick.model.Message.class), Extension.of(MessageQuery.class)) - .debugger(LogbackDebugger.class) - .defaultResponseTimeout(Duration.ofMillis(120000)) - .build(); + .defaultResponseTimeout(Duration.ofMillis(120000)); + if (logger.isTraceEnabled()) { + configurationBuilder.debugger(LogbackDebugger.class); + } + var configuration = configurationBuilder.build(); xmpp = ExternalComponent.create(componentName, password, configuration, componentHost, componentPort); ServiceDiscoveryManager serviceDiscoveryManager = xmpp.getManager(ServiceDiscoveryManager.class); serviceDiscoveryManager.addIdentity(Identity.clientBot().withName("Juick")); diff --git a/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java b/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java index c0d809c4..d13847ba 100644 --- a/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java +++ b/src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java @@ -37,12 +37,12 @@ public class LogbackDebugger implements XmppDebugger { @Override public void writeStanza(String s, Object o) { - logger.info("OUT: {}", s); + logger.trace("OUT: {}", s); } @Override public void readStanza(String s, Object o) { - logger.info("IN: {}", s); + logger.trace("IN: {}", s); } @Override -- cgit v1.2.3