Hi all,


A few months ago, Nathan Green has made a proposal [1] to add Java 8 support to org.slf4j.Logger. His proposal has the remarkable property of being backward compatible. Other proposals have been made since on the same subject [2].

The org.slf4j.Logger interface already contains 55+ methods. Nathan's proposal adds yet new methods. A complete proposal would perhaps double or triple the number of methods to 100 or even 150.

An alternative is to offer an event API allowing piecemeal construction of the logging event. Only when the event is fully constructed, is it offered to a Logger instance.

Usage example

LoggingEvent event = new LoggingEvent();
event.message("hello {}).parameter("world").marker(BLUE).level(DEBUG);

EventLogger logger = someFactory.getLogger();
logger.log(event);

Logback would fully support this interface but the same cannot be said of other logging frameworks. In that case there is not much use for introducing the interface in SLF4J instead of directly in logback.

Your comments are welcome.

--
Ceki

[1] http://mailman.qos.ch/pipermail/slf4j-dev/2015-October/004229.html
[2] https://github.com/qos-ch/slf4j/pull/70
_______________________________________________
slf4j-dev mailing list
slf4j-dev@qos.ch
http://mailman.qos.ch/mailman/listinfo/slf4j-dev

Reply via email to