Discussion:
[jira] [Created] (LOG4J2-837) Hex-dump layout for binary messages
Remko Popma (JIRA)
2014-09-18 17:34:34 UTC
Permalink
Remko Popma created LOG4J2-837:
----------------------------------

Summary: Hex-dump layout for binary messages
Key: LOG4J2-837
URL: https://issues.apache.org/jira/browse/LOG4J2-837
Project: Log4j 2
Issue Type: New Feature
Components: API, Layouts
Reporter: Gary Gregory
Assignee: Remko Popma


Add a layout that can format a BinaryMessage as text, each byte encoded as a hexadecimal number, with spacing and grouping to make the data easy to read.

BinaryMessage can be an interface as discussed in LOG4J2-506. One proposal is to also provide a ByteBufferMessage implementation that can be constructed from either a byte[] or a java.nio.ByteBuffer.

Ideas for BinaryLayout configuration parameters:

* group size in bytes (default 8)
* group count per line (default 4)
* uppercase vs. lowercase output (default?)
* base (default 16, should this even be configurable?)
* group separator (default space " ")
* char encoding (default UTF-8 or ASCII), if present extends the a line with text version of the bytes
* groups-text separator (default " | ")
* address-groups separator (default " | ")
* unprintable char (default .)

Example output line (bogus values):
{{00000 | 01234567 a1234567 b1234567 c1234567 | .HELLO...}}

This layout also needs some way to handle Messages that are _not_ BinaryMessages. One idea is to have a nested fallback layout that the BinaryLayout will delegate to for non-binary messages.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Loading...