[NETCONF-135] Logging: Binary data shall be emitted in the form of hexa numbers. Created: 29/Jan/16  Updated: 02/Jul/21

Status: Confirmed
Project: netconf
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Jozef Behran Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All



 Description   

Here is an example of the log message with the binary data emitted in a raw format (nonprintable or non-ASCII bytes were replaced by "?"):

2016-01-29 12:35:31,797 | TRACE | entLoopGroup-9-1 | AsyncSshHandlerWriter | 249 - org.opendaylight.netconf.netty-util - 1.0.0.SNAPSHOT | Writing request on channel: [id: 0xf21aeb32, local:E:f21aeb32 => local:netconf], message:
#93
$EXI????????
rpc-reply?????message-id?m-38data

The stuff in the log message appears to be Netconf RPC reply in EXI format. As EXI is a binary format, it should be either hexlified or emitted in the following format (which allows the ASCII data embedded in it to be readable without special processing):

2016-01-29 12:35:31,797 | TRACE | entLoopGroup-9-1 | AsyncSshHandlerWriter | 249 - org.opendaylight.netconf.netty-util - 1.0.0.SNAPSHOT | Writing request on channel: [id: 0xf21aeb32, local:E:f21aeb32 => local:netconf], message: 0A "#93" 0A "$EXI" EF BF BD 00 40 0E 5C 00 00 "'urn:ietf:params:xml:ns:netconf:base:1.0" 0A "rpc-reply" 02 04 00 01 01 01 0B "message-id" 06 "m-38" 01 03 04 05 "data" 00 00 0A "##" 0A

i.e. runs of ASCII characters from chr(32) to chr(126) (with possible exclusion of '"') at least 2 characters long emitted in "", everything else hexlified).



 Comments   
Comment by Vratko Polak [ 29/Jan/16 ]

The example log seems to come from netconf project /opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerWriter.java line 85.
Assigning to netconf project.

Comment by Oleksii Mozghovyi [ 01/Apr/21 ]

The following commit has been merged: https://git.opendaylight.org/gerrit/c/netconf/+/92760

Comment by Robert Varga [ 02/Jul/21 ]

Keeping this issue for follow refactor. I think its performance and semantics can be improved.

Generated at Wed Feb 07 20:14:15 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.