Ah, yes, but then, ALL byte arrays and ByteBuffers will be hex-dumped, which should be OK.
Well, this is what I am looking for, what is the best log4j2-way to do this. Gary On Tue, Sep 2, 2014 at 12:25 PM, Ralph Goers <[email protected]> wrote: > Note that you should also be able to do this with a Layout. > > Ralph > > On Sep 2, 2014, at 9:17 AM, Gary Gregory <[email protected]> wrote: > > On Tue, Sep 2, 2014 at 12:10 PM, Ralph Goers <[email protected]> > wrote: > >> So the output from a ByteBufferMessage is a hex dump of the data? >> > > Yes, with formatting options. Whether we pin it to hexadecimal or allow a > base to be configured is TBD. I only need hex ATM. > > Wouldn’t it make more sense to have a HexDumpMessage that accepts a byte >> buffer or byte array or a string or whatever? >> > > That's where I am going yes, perhaps my proposed class name was confusing. > ByteDumpMessage would be a more general version of HexDumpMessage. > > Gary > > >> Ralph >> >> On Sep 2, 2014, at 8:23 AM, Gary Gregory <[email protected]> wrote: >> >> Hi All: >> >> On every project I've worked on, at some point, I or someone needs to log >> of byte buffer (usually a byte[] but I am working a new project that uses >> an NIO ByteBuffer too). >> >> We do not have a Log4j ByteBufferMessage, how about adding one? That >> seems quite withing the scope of Log4j >> >> I would expect the following to be 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... >> >> Thoughts? >> >> Gary >> >> -- >> E-Mail: [email protected] | [email protected] >> <[email protected]> >> Java Persistence with Hibernate, Second Edition >> <http://www.manning.com/bauer3/> >> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> >> Spring Batch in Action <http://www.manning.com/templier/> >> Blog: http://garygregory.wordpress.com >> Home: http://garygregory.com/ >> Tweet! http://twitter.com/GaryGregory >> >> >> > > > -- > E-Mail: [email protected] | [email protected] > <[email protected]> > Java Persistence with Hibernate, Second Edition > <http://www.manning.com/bauer3/> > JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> > Spring Batch in Action <http://www.manning.com/templier/> > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory > > > -- E-Mail: [email protected] | [email protected] Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/> Spring Batch in Action <http://www.manning.com/templier/> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
