If you are using Logback as the implementation you can probably make use of layout support [1] and provide your custom layout. The layout would have access to the objects passed as part of logger arguments and can then interpret it as per your requirement
Chetan Mehrotra [1] http://logback.qos.ch/manual/layouts.html On Tue, May 12, 2015 at 6:41 AM, Max Ng <[email protected]> wrote: > Hi, > > We have some applications which use Splunk for log analysis. To make better > use of the query language we used objects to represent log message and > key/value pairs. Now we are trying to move from Log4j to Slf4j and one issue > is that Slf4j only support string messages, so currently we serialize > key/values before calling to slf4j and rehydrate them at the layout, but > this is not optimal in terms of both performance and clarity. I understand > the reasons behind http://www.slf4j.org/faq.html#string_or_object though, so > is there some other way to achieve structured logging in Slf4j? > > Thanks, > > Max > > > _______________________________________________ > slf4j-user mailing list > [email protected] > http://mailman.qos.ch/mailman/listinfo/slf4j-user _______________________________________________ slf4j-user mailing list [email protected] http://mailman.qos.ch/mailman/listinfo/slf4j-user
