diff options
author | Vitaly Takmazov | 2023-12-21 17:56:38 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-12-21 17:56:38 +0300 |
commit | e25ec6f291c3b04f6bf492ad5f803bbc379d27eb (patch) | |
tree | 7cde6742ae2ae20512273f6c88deefd9d3b89290 /src | |
parent | 611c2a7d8302b478ddb0eb3d67d7dc2046bed933 (diff) |
Log XMPP traffic at trace level
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/com/juick/XMPPManager.java | 10 | ||||
-rw-r--r-- | src/main/java/rocks/xmpp/core/session/debug/LogbackDebugger.java | 4 |
2 files changed, 8 insertions, 6 deletions
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 |