After looking more closely I found that the org.slf4j.spi.LocationAwareLogger::log <http://www.slf4j.org/api/org/slf4j/spi/LocationAwareLogger.html#log(org.slf4j.Marker, java.lang.String, int, java.lang.String, java.lang.Object[], java.lang.Throwable)> method is currently not implemented in a garbage-free manner in the log4j-slf4j-impl binding. It creates a new message object for each call. If there is interest we can address this in a future release. Other methods seem okay.
On Thursday, May 19, 2016 at 4:57:10 PM UTC+9, Jerry Shea wrote: > > Ok thanks! > On 19 May 2016 5:10 pm, "Remko Popma" <remko...@gmail.com <javascript:>> > wrote: > >> On Thursday, May 19, 2016 at 11:10:45 AM UTC+9, Jerry Shea wrote: >> > This is fantastic, thanks for this Remko. >> > >> > >> > Can I ask a couple of questions? >> > 1. is log4j 2.6 designed to operate garbage-free when used as an SLF4J >> implementation too, or only with the native API? >> >> The log4j-slf4j-impl binding is trying to be garbage-free, but the SLF4J >> API only offers up to two parameters for a parameterized message. More than >> that uses varargs which creates a temporary object for the parameter array. >> The native Log4j 2.6 API has methods for up to ten unrolled parameters. >> >> Another consideration is that the native Log4j 2 API lets you log >> Objects, not just Strings. Any Object that implements CharSequence can be >> logged without creating garbage. >> >> You can also implement the log4j Message interface if you want to >> separate formatting from your business domain objects. >> >> Finally, the native Log4j 2 API has support for logging Java 8 lambdas >> (since 2.4). >> >> > 2. when do you expect log4j 2.6 to be released GA i.e. ready for >> production use? >> >> Barring any showstoppers, I expect it will be available in a week or so. >> >>
--------------------------------------------------------------------- To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org