[slf4j-user] Apache style log fromats
ceki
ceki at qos.ch
Thu Nov 3 18:37:34 CET 2011
Hi Chad,
There was a lengthy discussion about this subject a while back. You
can already pass a map in a log call. For example,
logger.debug("{}", map);
the above is not pretty and somewhat lame but it will work.
There was a lengthy discussion about this issue a while back with
Joern Huxhorn and Ralph Goers. Search for "SLF4J Message interface".
Joern Huxhorn came up with the idea of the Message interface [1] which
allows for a cleaner API. I think the Message interface will be added
into SLF4J some time in the future.
--
Ceki
http://twitter.com/#!/ceki
[1]
https://github.com/huxi/slf4j/tree/slf4j-redesign/slf4j-n-api/src/main/java/org/slf4j/n
On 03/11/2011 2:59 PM, Chad La Joie wrote:
> We have a couple cases now where a facility like Apache's HTTPD
> logging mechanism would be nice. Specifically where, when an "event"
> is logged, what is provided is just a map of values and no format
> string. Then the the individual configuring logging configures a
> formatting string that controls what actually gets written out to the
> log file.
>
> From an SLF4J API perspective, I think this probably just means
> trace/debug/info/warn/error methods that take a map instead of a
> format and set of objects. It may even possible to do the actual
> implementation by just creating an MDC, add all the map information,
> calling the current logging methods with an empty format string, and
> then clearing out MDC, or something like that.
>
> Thoughts?
>
More information about the slf4j-user
mailing list