[logback-user] Change implementation of MessageFormatter for byte[]
Thorsten Schöning
tschoening at am-soft.de
Mon Jun 9 18:19:59 CEST 2014
Hi all,
I have a use case where I need to log some byte[] and the current
default behavior of slf4j seems to be to print decimal values for each
item in the array. I would prefer hex notation instead and can't seem
to find any way to configure that behavior. It seems to me it's
hard coded using LoggingEvent.getFormattedMessage and
MessageFormatte.byteArrayAppend.
Is there any way to change this behavior?
The only thing coming into my mind is overriding LoggingEvent with a
custom getFormattedMessage method, but I don't know how to get Logback
using that internally. And I wouldn't want to re-implement
MessageFormatter because it's most interesting methods are private.
Any other options like parsing the formatted message afterwards and
convert it to contain hex bytes instead? Though it sounds a lot more
difficult than converting into the format I want in the first place.
Thanks for your help!
Mit freundlichen Grüßen,
Thorsten Schöning
--
Thorsten Schöning E-Mail:Thorsten.Schoening at AM-SoFT.de
AM-SoFT IT-Systeme http://www.AM-SoFT.de/
Telefon...........05151- 9468- 55
Fax...............05151- 9468- 88
Mobil..............0178-8 9468- 04
AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
More information about the Logback-user
mailing list