diff --git a/oap-logstream/oap-logstream/src/main/java/oap/logstream/net/SocketLoggerServer.java b/oap-logstream/oap-logstream/src/main/java/oap/logstream/net/SocketLoggerServer.java index 2e7e608cca..409511394a 100644 --- a/oap-logstream/oap-logstream/src/main/java/oap/logstream/net/SocketLoggerServer.java +++ b/oap-logstream/oap-logstream/src/main/java/oap/logstream/net/SocketLoggerServer.java @@ -24,6 +24,7 @@ package oap.logstream.net; import lombok.extern.slf4j.Slf4j; +import oap.io.content.ContentReader; import oap.logstream.AbstractLoggerBackend; import oap.logstream.BackendLoggerNotAvailableException; import oap.logstream.InvalidProtocolVersionException; @@ -31,13 +32,18 @@ import oap.logstream.LogStreamProtocol.ProtocolVersion; import oap.logstream.LoggerException; import oap.message.MessageListener; +import oap.template.BinaryUtils; +import oap.tsv.Tsv; import java.io.ByteArrayInputStream; import java.io.Closeable; import java.io.DataInputStream; import java.io.EOFException; import java.io.IOException; +import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedHashMap; +import java.util.List; import static oap.logstream.LogStreamProtocol.MESSAGE_TYPE; @@ -124,8 +130,20 @@ private void readBinaryV2( ProtocolVersion version, String hostName, DataInputSt var buffer = new byte[length]; in.readFully( buffer, 0, length ); - log.trace( "[{}] logging (properties {} filePreffix {} logType {} headers {} types {}, {})", - hostName, properties, filePreffix, logType, headers, types, length ); + if ( log.isTraceEnabled() ) { + List> lines = new ArrayList<>(); + switch( version ) { + case TSV_V1 -> ContentReader.read( buffer, Tsv.tsv.ofSeparatedValues() ).toList() + .forEach( line -> lines.add( Collections.singletonList( line ) ) ); + case BINARY_V2 -> lines.addAll( BinaryUtils.read( buffer ) ); + } + + lines.forEach( line -> + log.trace( "[{}] logging (properties {} filePreffix {} logType {} headers {} types {}, length {}, line {})", + hostName, properties, filePreffix, logType, headers, types, length, line + ) + ); + } backend.log( version, clientHostname, filePreffix, properties, logType, headers, types, buffer, 0, length ); } diff --git a/pom.xml b/pom.xml index 1ce1d6f9d1..6a15a5b164 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ - 21.15.5 + 21.15.6 21.0.0 21.0.1