Uploaded image for project: 'Log4j 2'
  1. Log4j 2
  2. LOG4J2-837

Hex-dump layout for binary messages

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • API, Layouts


      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.


        Issue Links


          This comment will be Viewable by All Users Viewable by All Users


            rpopma Remko Popma
            ggregory Gary D. Gregory




                Issue deployment