aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/handler/StandardLoggingHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-02 08:22:53 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-02 08:22:53 -0700
commit9633eccdead886ed0b580707ad76cdf06df9a603 (patch)
tree22144dad702d22318c62d8adff96851b605b9b48 /src/main/java/org/traccar/handler/StandardLoggingHandler.java
parent19869710f012cbf1a32063021d59aa2d58688e6b (diff)
downloadtrackermap-server-9633eccdead886ed0b580707ad76cdf06df9a603.tar.gz
trackermap-server-9633eccdead886ed0b580707ad76cdf06df9a603.tar.bz2
trackermap-server-9633eccdead886ed0b580707ad76cdf06df9a603.zip
Log transport layer protocol
Diffstat (limited to 'src/main/java/org/traccar/handler/StandardLoggingHandler.java')
-rw-r--r--src/main/java/org/traccar/handler/StandardLoggingHandler.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/handler/StandardLoggingHandler.java b/src/main/java/org/traccar/handler/StandardLoggingHandler.java
index 13c5f8281..84492e2a5 100644
--- a/src/main/java/org/traccar/handler/StandardLoggingHandler.java
+++ b/src/main/java/org/traccar/handler/StandardLoggingHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 Anton Tananaev (anton@traccar.org)
+ * Copyright 2019 - 2022 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import io.netty.channel.ChannelPromise;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.traccar.NetworkMessage;
+import org.traccar.helper.NetworkUtil;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -63,7 +64,7 @@ public class StandardLoggingHandler extends ChannelDuplexHandler {
public void log(ChannelHandlerContext ctx, boolean downstream, SocketAddress remoteAddress, ByteBuf buf) {
StringBuilder message = new StringBuilder();
- message.append("[").append(ctx.channel().id().asShortText()).append(": ");
+ message.append("[").append(NetworkUtil.session(ctx.channel())).append(": ");
message.append(protocol);
if (downstream) {
message.append(" > ");
@@ -76,9 +77,8 @@ public class StandardLoggingHandler extends ChannelDuplexHandler {
} else {
message.append("unknown");
}
- message.append("]");
+ message.append("] ");
- message.append(" HEX: ");
message.append(ByteBufUtil.hexDump(buf));
LOGGER.info(message.toString());