From 2d8b613a3ad48acafd683f5286e29c3f1c167275 Mon Sep 17 00:00:00 2001 From: Sho Sakuma Date: Mon, 3 Aug 2026 00:40:30 +0900 Subject: perf: take per-message logging off the chat path Every channel message wrote a fully interpolated INFO line, duplicating what the dedicated async ChannelMessageLogger already persists. Every cross-server message produced one INFO on the sending Paper server, two on Velocity, and one on each receiving Paper server - so a single global chat message cost up to four synchronous console and latest.log writes across the network, on the message path, with JUL and Logback appenders being synchronous. These are now debug, and phrased so the string is not built unless debug is on: the JUL sites take a supplier, the slf4j sites take a format plus arguments. Handshake, registration and delivery-failure lines stay at info - they fire once per server or once per failed message, and they explain something an operator needs to see. Two relay tests asserted on the text of a log line. One of them was verifying "0 servers" where the same test already verifies zero sends; the other was really checking that the payload reaches the target, so it now decodes the relayed bytes and compares them to the original message. Co-Authored-By: Claude --- .../m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt | 2 +- .../m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt | 8 ++++---- .../lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'platform-paper') diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt index 985f321..4cfd061 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/chat/handler/ChannelMessageHandler.kt @@ -75,7 +75,7 @@ class ChannelMessageHandler( } } - logger.info("Channel Message from ${player.name} in ${context.channel.name}: $message") + logger.debug("Channel Message from {} in {}: {}", player.name, context.channel.name, message) // Log message to file if logging is enabled messageLogger?.let { diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt index 2f2bde0..19668be 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerChatManager.kt @@ -69,7 +69,7 @@ class CrossServerChatManager( PluginMessageChannel.ID, PluginMessageCodec.encode(globalChatMessage), ) - logger.info("Sent global chat message to Velocity: messageId=$messageId, player=$playerName") + logger.fine { "Sent global chat message to Velocity: messageId=$messageId, player=$playerName" } } else { logger.warning("Cannot send global chat message: player $playerId not found") } @@ -109,10 +109,10 @@ class CrossServerChatManager( }, ) - logger.info( + logger.fine { "Broadcasted global chat message from ${message.serverName}: " + - "player=${message.playerName}, messageId=${message.messageId}", - ) + "player=${message.playerName}, messageId=${message.messageId}" + } } catch (e: Exception) { logger.log(Level.SEVERE, "Failed to handle incoming global chat message", e) } diff --git a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt index b35f6a5..76cc879 100644 --- a/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt +++ b/platform-paper/src/main/kotlin/dev/m1sk9/lunaticChat/paper/velocity/CrossServerDirectMessageManager.kt @@ -69,10 +69,10 @@ class CrossServerDirectMessageManager( ) sender.sendPluginMessage(plugin, PluginMessageChannel.ID, PluginMessageCodec.encode(relay)) - logger.info( + logger.fine { "Sent direct message to Velocity: messageId=$messageId, " + - "target=$targetName@$targetServerName", - ) + "target=$targetName@$targetServerName" + } } catch (e: Exception) { logger.log(Level.SEVERE, "Failed to send cross-server direct message", e) } -- cgit v1.2.1